﻿namespace HCRS.Implementation
{
    using Common;
    using HCRS.BusinessEntities;
    using HCRS.DBACL;
    using Hubs1;
    using System;
    using System.Configuration;
    using System.Data;
    using System.IO;
    using System.Text;
    using System.Web;

    /// <summary>
    /// HotelClass 的摘要说明
    /// </summary>
    public class HotelClass
    {
        private DataAccessLayer _DataAccessLayer = new DataAccessLayer();
        private string[] Day = new string[] { "星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六" };

        /// <summary>
        /// 添加cc_mail表数据
        /// </summary>
        /// <param name="Title">标题</param>
        /// <param name="MailTo">mail</param>
        /// <param name="MailFrom">mail</param>
        /// <param name="Content">mail格式</param>
        /// <param name="Encode">mail编码</param>
        /// <param name="Prio"></param>
        /// <param name="Send"></param>
        /// <param name="Type">类型</param>
        /// <param name="AddTime">加入时间</param>
        /// <param name="UserID">添加用户id</param>
        public void AddMail(string Title, string MailTo, string MailFrom, string Content, string Encode, int Prio, int Send, int Type, DateTime AddTime, int UserID)
        {
            Content = Content.Replace("'", "‘");
            this._DataAccessLayer.RunSqlStrings(string.Concat(new object[] { 
                "insert into CC_Mail (title,mailto,mailfrom,content,encode,prio,send,Err,type,addtime,userid) values ('", Title, "','", MailTo, "','", MailFrom, "','", Content, "','", Encode, "',", Prio, ",", Send, ",0,", Type, 
                ",'", AddTime, "',0)"
             }));
        }

        /// <summary>
        /// 取消制度.调用方法:cxlruledetail
        /// </summary>
        /// <param name="ipid">酒店id</param>
        /// <param name="rule">取消制度</param>
        /// <returns>制度描述</returns>
        public string cxlruledetail(int ipid, string rule)
        {
            return this.cxlruledetail(ipid, rule, 0);
        }

        /// <summary>
        /// 返回取消制度
        /// </summary>
        /// <param name="ipid">酒店id</param>
        /// <param name="rule">取消制度</param>
        /// <param name="languagetype">返回中文或英文 只能是cn或en</param>
        /// <returns>返回取消制度描述</returns>
        public string cxlruledetail(int ipid, string rule, int languagetype)
        {
            string str = "";
            this._DataAccessLayer.ClearParameter();
            this._DataAccessLayer.addNewParameter("@Property_id", ipid);
            this._DataAccessLayer.addNewParameter("@Languagetype", languagetype);
            this._DataAccessLayer.addNewParameter("@rule", rule, 50);
            DataTable table = this._DataAccessLayer.RunStoreDataTable("selectCXL");
            if ((table != null) && (table.Rows.Count > 0))
            {
                if ((table.Rows[0]["Description"] != null) && (table.Rows[0]["Description"].ToString() != ""))
                {
                    str = table.Rows[0]["Description"].ToString();
                }
                return str;
            }
            if (languagetype == 1)
            {
                return "no penalty";
            }
            return "取消预订不收罚金";
        }

        /// <summary>
        /// 格式化时间
        /// </summary>
        /// <param name="checkinout">时间参数.如:1800</param>
        /// <returns>返回格式化后的时间:18:00 </returns>
        private string formatCheckInOut(string checkinout)
        {
            if (checkinout.Length != 5)
            {
                if (checkinout.Length == 1)
                {
                    checkinout = "0" + checkinout;
                }
                if (checkinout.Length == 4)
                {
                    checkinout = checkinout.Insert(2, ":");
                }
                else
                {
                    checkinout = checkinout + ":00";
                }
            }
            return checkinout;
        }

        /// <summary>
        /// 获取信用卡名称
        /// </summary>
        /// <param name="c">信用卡类别</param>
        /// <returns>信用卡名称</returns>
        public string getCredit(string c)
        {
            switch (c)
            {
                case "Diners":
                    return "Diners Club";

                case "AX":
                    return "American Express";

                case "MC":
                    return "MasterCard";

                case "JC":
                    return "JCB";

                case "DC":
                    return "Diners Club";

                case "CA":
                    return "Cash";

                case "PP":
                    return "Pre-Paid ";

                case "CB":
                    return "Carte Blanche";
            }
            return "Visa";
        }

        /// <summary>
        /// 返回酒店css信息
        /// </summary>
        /// <param name="PID">酒店id</param>
        /// <param name="languagetype">返回中文或英文 只能是cn或en</param>
        /// <returns>酒店css信息</returns>
        public string GetCSSContrel(int PID, int languagetype)
        {
            string[] strArray = this._DataAccessLayer.RunSqlStrings(string.Concat(new object[] { "select css from  CRM_hotelweb_domain where property_id=", PID, " and languagetype=", languagetype }));
            string str = "";
            if ((strArray != null) && (strArray.Length > 0))
            {
                return strArray[0];
            }
            str = "@charset \"utf-8\";";
            return (((((((str + "body {\tbackground-color: #ffffff; background:url(bg.jpg); background-repeat:repeat;color:#333333;font-size:12px;font-size:12px;}" + ".table_rate {\tborder: 1px solid #CCCCCC; width:95%; background:url(bg.jpg); background-repeat:repeat;margin:auto;}") + ".table_user {\tborder: 1px solid #CCCCCC; width:95%; background:url(bg.jpg); background-repeat:repeat;margin:auto;}" + ".table_other{\tborder: 1px solid #CCCCCC; width:95%; background:url(bg.jpg); background-repeat:repeat;margin:auto;}") + ".tableboder {\tborder: 1px solid #999999;\tfont-family: Arial, Helvetica, sans-serif;\tfont-size: 12px;}" + ".tdbackcolorhead {\tbackground-color: #B5CDFF;\t}") + ".tdbackcolorgrey {\tbackground-color: #efefef;\t}" + ".tdborder {\tborder: 1px solid #CCCCCC;\t}") + "a:link{ color:#666666; text-decoration:none}" + "a:hover{color:#CCCCCC; text-decoration:none}") + "a:visited{color:#999999; text-decoration:none}" + "td{font:Arial, Helvetica, sans-serif; font-size:12px; color:#333333;}") + ".font_bold{font-weight:bold}" + ".font_messgae{font-weight:bold; color:#FF6600;}");
        }

        /// <summary>
        /// 返回默认价格代码
        /// </summary>
        /// <param name="PID">酒店id</param>
        /// <param name="languagetype">返回中文或英文 只能是cn或en</param>
        /// <returns>价格代码</returns>
        public string GetDefaultRates(int PID, int languagetype)
        {
            string[] strArray = this._DataAccessLayer.RunSqlStrings(string.Concat(new object[] { "select ratecode from [CRM_hotelweb_domain] where property_id=", PID, " and languagetype=", languagetype }));
            if ((strArray != null) && (strArray.Length > 0))
            {
                return strArray[0];
            }
            return "BAR|BARB,RACK";
        }

        /// <summary>
        /// 返回酒店网址
        /// </summary>
        /// <param name="PID">酒店id</param>
        /// <param name="languagetype">返回中文或英文 只能是cn或en</param>
        /// <returns>酒店网址</returns>
        public string GetDomain(int PID, int languagetype)
        {
            string[] strArray = this._DataAccessLayer.RunSqlStrings(string.Concat(new object[] { "select webdomain from [CRM_hotelweb_domain] where property_id=", PID, " and languagetype=", languagetype }));
            if ((strArray != null) && (strArray.Length > 0))
            {
                return strArray[0];
            }
            return "http://www.hubs1.net";
        }

        /// <summary>
        /// 返回预订引擎酒店email
        /// </summary>
        /// <param name="PID">酒店id</param>
        /// <param name="languagetype">返回中文或英文 只能是cn或en</param>
        /// <returns>预订引擎酒店email</returns>
        public string[] GetEmailSetting(int PID, int languagetype)
        {
            return this._DataAccessLayer.RunSqlStrings(string.Concat(new object[] { "select emailFrom,emailAlias from [CRM_hotelweb_domain] where property_id=", PID, " and languagetype=", languagetype }));
        }

        /// <summary>
        /// 返回集团css信息
        /// </summary>
        /// <param name="PID">集团id</param>
        /// <param name="languagetype">返回中文或英文 只能是cn或en</param>
        /// <returns>集团css信息</returns>
        public string GetGroupCSSContrel(int GID, int languagetype)
        {
            string[] strArray = this._DataAccessLayer.RunSqlStrings(string.Concat(new object[] { "select css from  CRM_Groupweb_domain where classid=", GID, " and languagetype=", languagetype }));
            string str = "";
            if ((strArray != null) && (strArray.Length > 0))
            {
                return strArray[0];
            }
            str = "@charset \"utf-8\";";
            return (((((((str + "body {\tbackground-color: #ffffff; background:url(bg.jpg); background-repeat:repeat;color:#333333;font-size:12px;font-size:12px;}" + ".table_rate {\tborder: 1px solid #CCCCCC; width:95%; background:url(bg.jpg); background-repeat:repeat;margin:auto;}") + ".table_user {\tborder: 1px solid #CCCCCC; width:95%; background:url(bg.jpg); background-repeat:repeat;margin:auto;}" + ".table_other{\tborder: 1px solid #CCCCCC; width:95%; background:url(bg.jpg); background-repeat:repeat;margin:auto;}") + ".tableboder {\tborder: 1px solid #999999;\tfont-family: Arial, Helvetica, sans-serif;\tfont-size: 12px;}" + ".tdbackcolorhead {\tbackground-color: #B5CDFF;\t}") + ".tdbackcolorgrey {\tbackground-color: #efefef;\t}" + ".tdborder {\tborder: 1px solid #CCCCCC;\t}") + "a:link{ color:#666666; text-decoration:none}" + "a:hover{color:#CCCCCC; text-decoration:none}") + "a:visited{color:#999999; text-decoration:none}" + "td{font:Arial, Helvetica, sans-serif; font-size:12px; color:#333333;}") + ".font_bold{font-weight:bold}" + ".font_messgae{font-weight:bold; color:#FF6600;}");
        }

        /// <summary>
        /// 返回集团网址
        /// </summary>
        /// <param name="GID">集团id</param>
        /// <param name="languagetype">返回中文或英文 只能是cn或en</param>
        /// <returns>集团网址</returns>
        public string GetGroupDomain(int GID, int languagetype)
        {
            string[] strArray = this._DataAccessLayer.RunSqlStrings(string.Concat(new object[] { "select webdomain from [CRM_Groupweb_domain] where classid=", GID, " and languagetype=", languagetype }));
            if ((strArray != null) && (strArray.Length > 0))
            {
                return strArray[0];
            }
            return "http://www.hubs1.net";
        }

        /// <summary>
        /// 返回默认集团价格代码
        /// </summary>
        /// <param name="GID">集团id</param>
        /// <param name="languagetype">返回中文或英文 只能是cn或en</param>
        /// <returns>价格代码</returns>
        public string GetGroupRates(int GID, int languagetype)
        {
            string[] strArray = this._DataAccessLayer.RunSqlStrings(string.Concat(new object[] { "select ratecode from [CRM_Groupweb_domain] where ClassID=", GID, " and languagetype=", languagetype }));
            if ((strArray != null) && (strArray.Length > 0))
            {
                return strArray[0];
            }
            return "BAR|BARB,RACK";
        }

        /// <summary>
        /// HCMS_获取酒店的信息  
        /// </summary>
        /// <param name="pid">酒店id</param>
        /// <returns>酒店信息</returns>
        public DataRow GetHotelInfo(int pid)
        {
            return this._DataAccessLayer.RunSqlDataRow("select top 1 * from CRM_hotelweb_domain where property_id=" + pid);
        }

        /// <summary>
        /// 返回预订引擎取消预订标语
        /// </summary>
        /// <param name="PID">酒店id</param>
        /// <param name="languagetype">返回中文或英文 只能是cn或en</param>
        /// <returns>预订引擎取消预订标语</returns>
        public string GetSloganCxl(int PID, int languagetype)
        {
            string[] strArray = this._DataAccessLayer.RunSqlStrings(string.Concat(new object[] { "select sloganCxl from [CRM_hotelweb_domain] where property_id=", PID, " and languagetype=", languagetype }));
            if ((strArray != null) && (strArray.Length > 0))
            {
                return strArray[0];
            }
            return "符合取消规则的预订可以被取消。如果这个预订是要求保证金保证的，酒店将扣除这个预订的保证金<br>我们通过Email为您发送取消确认信，如果您不能及时获取取消确认信，请通过HUBS1的呼叫中心来查询、修改或取消预订： 800-819-5677 或 400-670-5677";
        }

        /// <summary>
        /// 返回预订引擎修改预订标语
        /// </summary>
        /// <param name="PID">酒店id</param>
        /// <param name="languagetype">返回中文或英文 只能是cn或en</param>
        /// <returns>预订引擎修改预订标语</returns>
        public string GetSloganMod(int PID, int languagetype)
        {
            string[] strArray = this._DataAccessLayer.RunSqlStrings(string.Concat(new object[] { "select sloganMod from [CRM_hotelweb_domain] where property_id=", PID, " and languagetype=", languagetype }));
            if ((strArray != null) && (strArray.Length > 0))
            {
                return strArray[0];
            }
            return "请输入本次预订客人的详细信息。在这个区域输入的姓名将被用作更改或取消本次预订，所以请正确输入。<br/>我们通过Email为您发送预订确认信，Email信箱是必须的，如果您不能及时获取确认信，请通过HUBS1的呼叫中心来查询、修改或取消预订： 800-819-5677 或 400-670-5677";
        }

        /// <summary>
        /// 返回预订引擎新预订标语
        /// </summary>
        /// <param name="PID">酒店id</param>
        /// <param name="languagetype">返回中文或英文 只能是cn或en</param>
        /// <returns>预订引擎新预订标语</returns>
        public string GetSloganNewResv(int PID, int languagetype)
        {
            string[] strArray = this._DataAccessLayer.RunSqlStrings(string.Concat(new object[] { "select sloganNewResv from [CRM_hotelweb_domain] where property_id=", PID, " and languagetype=", languagetype }));
            if ((strArray != null) && (strArray.Length > 0))
            {
                return strArray[0];
            }
            return "如有问题请联系锦江预订中心： 800-819-5677,手机用户拨打400-670-5677或通过service@hubs1.net邮箱联系";
        }

        /// <summary>
        /// 返回预订引擎预订标语
        /// </summary>
        /// <param name="PID">酒店id</param>
        /// <param name="languagetype">返回中文或英文 只能是cn或en</param>
        /// <returns>预订引擎预订标语</returns>
        public string GetSloganResv(int PID, int languagetype)
        {
            string[] strArray = this._DataAccessLayer.RunSqlStrings(string.Concat(new object[] { "select sloganResv from [CRM_hotelweb_domain] where property_id=", PID, " and languagetype=", languagetype }));
            if ((strArray != null) && (strArray.Length > 0))
            {
                return strArray[0];
            }
            return "我们通过Email为您发送预订确认信，Email信箱是必须的，如果您不能及时获取确认信，请通过HUBS1的呼叫中心来查询、修改或取消预订： 021－61226688－7800 ";
        }

        /// <summary>
        /// 调用getStates方法,返回入住状态
        /// </summary>
        /// <param name="iStates">状态值</param>
        /// <returns>入住状态</returns>
        public string getStates(int iStates)
        {
            return this.getStates(iStates, 0);
        }

        /// <summary>
        /// 返回入住状态
        /// </summary>
        /// <param name="iStates">入住状态值</param>
        /// <param name="languagetype">返回中文或英文 只能是cn或en</param>
        /// <returns>入住状态</returns>
        public string getStates(int iStates, int languagetype)
        {
            if (languagetype != 0)
            {
                switch (iStates)
                {
                    case 0:
                        return "New";

                    case 1:
                        return "Confirmed";

                    case 2:
                    case 3:
                    case 6:
                        goto Label_00DB;

                    case 4:
                        return "Cancelled";

                    case 5:
                        return "No show";

                    case 7:
                        return "Check in";

                    case 8:
                        return "Departure";
                }
            }
            else
            {
                switch (iStates)
                {
                    case 0:
                        return "新单";

                    case 1:
                        return "已处理";

                    case 4:
                        return "取消";

                    case 5:
                        return "应到未到";

                    case 7:
                        return "入住";

                    case 8:
                        return "离店";
                }
                return "新单";
            }
        Label_00DB:
            return "New";
        }

        /// <summary>
        /// 获取保证金制度.调用 guarruledetail方法.
        /// </summary>
        /// <param name="ipid">酒店id</param>
        /// <param name="rule">保证金制度</param>
        /// <returns>制度描述.</returns>
        public string guarruledetail(int ipid, string rule)
        {
            return this.guarruledetail(ipid, rule, 0);
        }

        /// <summary>
        /// 返回保证金制度.
        /// </summary>
        /// <param name="ipid">酒店id</param>
        /// <param name="rule">保证金制度</param>
        /// <param name="languagetype">返回中文或英文 只能是cn或en</param>
        /// <returns>制度描述</returns>
        public string guarruledetail(int ipid, string rule, int languagetype)
        {
            this._DataAccessLayer.ClearParameter();
            this._DataAccessLayer.addNewParameter("@Property_id", ipid);
            this._DataAccessLayer.addNewParameter("@Languagetype", languagetype);
            this._DataAccessLayer.addNewParameter("@Grule", rule, 50);
            DataTable table = this._DataAccessLayer.RunStoreDataTable("selectGUA");
            try
            {
                if (table.Rows.Count > 0)
                {
                    if ((table.Rows[0]["GDescription"] != null) && (table.Rows[0]["GDescription"].ToString().Length > 0))
                    {
                        return table.Rows[0]["GDescription"].ToString();
                    }
                    if (languagetype == 1)
                    {
                        return "no guarantee rule";
                    }
                    return "不需要保证金";
                }
                if (languagetype == 1)
                {
                    return "no guarantee rule";
                }
                return "不需要保证金";
            }
            catch
            {
                if (languagetype == 1)
                {
                    return "please contact us for guarantee fee information";
                }
                return "请与我们联系了解保证金制度";
            }
        }

        /// <summary>
        /// 用户选择酒店,从crs返回数据修改数据库h_cache表
        /// </summary>
        /// <param name="Property_id">酒店id</param>
        /// <param name="plancode">计划代码</param>
        /// <param name="Availdate">可用日期</param>
        /// <param name="singlerate">单人价</param>
        /// <param name="doublerate">双人</param>
        /// <param name="triplerate"> 三人价</param>
        /// <param name="quadrate">四人价</param>
        /// <param name="extraadult">加床成人价</param>
        /// <param name="extrachildren">加床儿童价</param>
        /// <param name="Allotment">房量</param>
        /// <param name="AllotMax">最大入住量</param>
        /// <param name="AvStat">房间状态</param>
        /// <param name="MaxLos">最大如住天数</param>
        /// <param name="MinLos">最小入住天数</param>
        /// <param name="RateCode">价格代码</param>
        /// <param name="RoomCode">房型代码</param>
        /// <param name="Tcode">CRS保留值</param>
        /// <param name="T_from">时间间隔</param>
        /// <param name="T_to">时间间隔</param>
        /// <param name="Roomdesc">房型代码</param>
        /// <param name="plandesc">计划描述</param>
        /// <param name="Gua">保证金制度</param>
        /// <param name="Cxl">取消制度</param>
        /// <param name="PriceNoTax">价格</param>
        /// <param name="cutOff">是否关闭</param>
        /// <param name="planname">计划名称</param>
        /// <param name="roomname">房型名称</param>
        public void ModH_Cache(int Property_id, string plancode, string Availdate, decimal singlerate, decimal doublerate, decimal triplerate, decimal quadrate, decimal extraadult, decimal extrachildren, int Allotment, int AllotMax, string AvStat, int MaxLos, int MinLos, string RateCode, string RoomCode, string Tcode, string T_from, string T_to, string Roomdesc, string plandesc, string Gua, string Cxl, decimal PriceNoTax, int cutOff, string planname, string roomname)
        {
            string[] ziduan = new string[] { 
                "Property_id", "plancode", "Availdate", " singlerate", "doublerate", "triplerate", "quadrate", " extraadult", "extrachildren", "Allotment", "AllotMax", " AvStat", "MaxLos", "MinLos", "RateCode", "RoomCode", 
                "Tcode", "T_from", "T_to", "Gua", " Cxl", "PriceNoTax", "cutOff"
             };
            string[] msg = new string[] { 
                Property_id.ToString(), plancode, Availdate, singlerate.ToString(), doublerate.ToString(), triplerate.ToString(), quadrate.ToString(), extraadult.ToString(), extrachildren.ToString(), Allotment.ToString(), AllotMax.ToString(), AvStat, MaxLos.ToString(), MinLos.ToString(), RateCode, RoomCode, 
                Tcode, T_from, T_to, Gua, Cxl, PriceNoTax.ToString(), cutOff.ToString()
             };
            if (this._DataAccessLayer.RunSqlExists(string.Concat(new object[] { "select top 1 property_id from h_cache with(nolock) where property_id=", Property_id, " and plancode='", plancode, "' and availdate='", Availdate, "'" })))
            {
                this._DataAccessLayer.UpdateData("h_cache", ziduan, msg, string.Concat(new object[] { " property_id=", Property_id, " and plancode='", plancode, "' and availdate='", Availdate, "'" }));
            }
            else
            {
                this._DataAccessLayer.InsertDataStr("h_cache", ziduan, msg);
            }
            string[] strArray3 = new string[] { "Property_id", "plancode", "roomCode", "planname", "roomname", "roomdesc", "plandesc", "type" };
            string[] strArray4 = new string[] { Property_id.ToString(), plancode, RoomCode, planname, roomname, Roomdesc, plandesc, "plan" };
            if (this._DataAccessLayer.RunSqlExists(string.Concat(new object[] { "select top 1 property_id from h_plan with(nolock) where property_id=", Property_id, " and plancode='", plancode, "' " })))
            {
                this._DataAccessLayer.UpdateData("h_plan", strArray3, strArray4, string.Concat(new object[] { " property_id=", Property_id, " and plancode='", plancode, "'" }));
                if (!this._DataAccessLayer.RunSqlExists(string.Concat(new object[] { "select top 1 property_id from h_plan with(nolock) where property_id=", Property_id, " and plancode='", plancode, "' and languagetype=1" })))
                {
                    strArray3 = new string[] { "Property_id", "plancode", "roomCode", "planname", "roomname", "roomdesc", "plandesc", "type", "languagetype" };
                    strArray4 = new string[] { Property_id.ToString(), plancode, RoomCode, planname, roomname, Roomdesc, plandesc, "plan", "1" };
                    this._DataAccessLayer.InsertDataStr("h_plan", strArray3, strArray4);
                }
            }
            else
            {
                this._DataAccessLayer.InsertDataStr("h_plan", strArray3, strArray4);
                strArray3 = new string[] { "Property_id", "plancode", "roomCode", "planname", "roomname", "roomdesc", "plandesc", "type", "languagetype" };
                strArray4 = new string[] { Property_id.ToString(), plancode, RoomCode, planname, roomname, Roomdesc, plandesc, "plan", "1" };
                this._DataAccessLayer.InsertDataStr("h_plan", strArray3, strArray4);
            }
        }

        /// <summary>
        /// 用户选择酒店,从crs返回数据修改数据库h_cache表
        /// </summary>
        /// <param name="Property_id">酒店id</param>
        /// <param name="plancode">计划代码</param>
        /// <param name="Availdate">可用日期</param>
        /// <param name="singlerate">单人价</param>
        /// <param name="doublerate">双人</param>
        /// <param name="triplerate"> 三人价</param>
        /// <param name="quadrate">四人价</param>
        /// <param name="extraadult">加床成人价</param>
        /// <param name="extrachildren">加床儿童价</param>
        /// <param name="Allotment">房量</param>
        /// <param name="AllotMax">最大入住量</param>
        /// <param name="AvStat">房间状态</param>
        /// <param name="MaxLos">最大如住天数</param>
        /// <param name="MinLos">最小入住天数</param>
        /// <param name="RateCode">价格代码</param>
        /// <param name="RoomCode">房型代码</param>
        /// <param name="Tcode">CRS保留值</param>
        /// <param name="T_from">时间间隔</param>
        /// <param name="T_to">时间间隔</param>
        /// <param name="Roomdesc">房型代码</param>
        /// <param name="plandesc">计划描述</param>
        /// <param name="Gua">保证金制度</param>
        /// <param name="Cxl">取消制度</param>
        /// <param name="PriceNoTax">价格</param>
        /// <param name="cutOff">是否关闭</param>
        /// <param name="planname">计划名称</param>
        /// <param name="roomname">房型名称</param>
        public void ModH_Cache(int language, int Property_id, string plancode, string Availdate, decimal singlerate, decimal doublerate, decimal triplerate, decimal quadrate, decimal extraadult, decimal extrachildren, int Allotment, int AllotMax, string AvStat, int MaxLos, int MinLos, string RateCode, string RoomCode, string Tcode, string T_from, string T_to, string Roomdesc, string plandesc, string Gua, string Cxl, decimal PriceNoTax, int cutOff, string planname, string roomname)
        {
            string msg = "";
            if (this._DataAccessLayer.RunSqlExists(string.Concat(new object[] { "select top 1 property_id from h_cache with(nolock) where property_id=", Property_id, " and plancode='", plancode, "' and availdate='", Availdate, "'" })))
            {
                this._DataAccessLayer.ExecUpdateSQL("h_cache", new string[] { 
                    " singlerate", "doublerate", "triplerate", "quadrate", " extraadult", "extrachildren", "Allotment", "AllotMax", " AvStat", "MaxLos", "MinLos", "RateCode", "RoomCode", "Tcode", "T_from", "T_to", 
                    "Gua", " Cxl", "PriceNoTax", "cutOff"
                 }, new string[] { 
                    " decimal", "decimal", "decimal", "decimal", " decimal", "decimal", "int", "int", " string", "int", "int", "string", "string", "string", "datetime", "datetime", 
                    "string", " string", "decimal", "int"
                 }, new object[] { 
                    singlerate.ToString(), doublerate.ToString(), triplerate.ToString(), quadrate.ToString(), extraadult.ToString(), extrachildren.ToString(), Allotment.ToString(), AllotMax.ToString(), AvStat, MaxLos.ToString(), MinLos.ToString(), RateCode, RoomCode, Tcode, T_from, T_to, 
                    Gua, Cxl, PriceNoTax.ToString(), cutOff.ToString()
                 }, new string[] { "Property_id", "plancode", "Availdate" }, new string[] { "int", "string", "datetime" }, new object[] { Property_id, plancode, Availdate }, out msg);
            }
            else
            {
                this._DataAccessLayer.ExecInsertSQL("h_cache", new string[] { 
                    "Property_id", "plancode", "Availdate", " singlerate", "doublerate", "triplerate", "quadrate", " extraadult", "extrachildren", "Allotment", "AllotMax", " AvStat", "MaxLos", "MinLos", "RateCode", "RoomCode", 
                    "Tcode", "T_from", "T_to", "Gua", " Cxl", "PriceNoTax", "cutOff"
                 }, new string[] { 
                    "int", "string", "datetime", " decimal", "decimal", "decimal", "decimal", " decimal", "decimal", "int", "int", " string", "int", "int", "string", "string", 
                    "string", "datetime", "datetime", "string", " string", "decimal", "int"
                 }, new object[] { 
                    Property_id, plancode, Availdate, singlerate.ToString(), doublerate.ToString(), triplerate.ToString(), quadrate.ToString(), extraadult.ToString(), extrachildren.ToString(), Allotment.ToString(), AllotMax.ToString(), AvStat, MaxLos.ToString(), MinLos.ToString(), RateCode, RoomCode, 
                    Tcode, T_from, T_to, Gua, Cxl, PriceNoTax.ToString(), cutOff.ToString()
                 }, out msg);
            }
            if (this._DataAccessLayer.RunSqlExists(string.Concat(new object[] { "select top 1 property_id from h_plan with(nolock) where property_id=", Property_id, " and plancode='", plancode, "' and languagetype=", language, " " })))
            {
                this._DataAccessLayer.ExecUpdateSQL("h_plan", new string[] { "roomCode", "planname", "roomname", "roomdesc", "plandesc", "type" }, new string[] { "string", "string", "string", "string", "string", "string" }, new object[] { RoomCode, planname, roomname, Roomdesc, plandesc, "plan" }, new string[] { "Property_id", "plancode", "languagetype" }, new string[] { "int", "string", "int" }, new object[] { Property_id, plancode, language }, out msg);
            }
            else
            {
                this._DataAccessLayer.ExecInsertSQL("h_plan", new string[] { "Property_id", "plancode", "languagetype", "roomCode", "planname", "roomname", "roomdesc", "plandesc", "type" }, new string[] { "int", "string", "int", "string", "string", "string", "string", "string", "string" }, new object[] { Property_id, plancode, language, RoomCode, planname, roomname, Roomdesc, plandesc, "plan" }, out msg);
            }
        }

        /// <summary>
        /// 更新酒店价格支持多人价格（2009-03-17 by field ）
        /// </summary>
        /// <param name="person">入住人数</param>
        /// <param name="language">语言</param>
        /// <param name="Property_id">酒店pid</param>
        /// <param name="plancode">计划代码</param>
        /// <param name="Availdate">入住日期</param>
        /// <param name="singlerate">单人价</param>
        /// <param name="doublerate">双人价</param>
        /// <param name="triplerate">三人价</param>
        /// <param name="quadrate">四人价</param>
        /// <param name="extraadult">成人加床价</param>
        /// <param name="extrachildren">儿童加床价</param>
        /// <param name="Allotment">房间数量</param>
        /// <param name="AllotMax"></param>
        /// <param name="AvStat"></param>
        /// <param name="MaxLos"></param>
        /// <param name="MinLos"></param>
        /// <param name="RateCode"></param>
        /// <param name="RoomCode"></param>
        /// <param name="Tcode"></param>
        /// <param name="T_from"></param>
        /// <param name="T_to"></param>
        /// <param name="Roomdesc"></param>
        /// <param name="plandesc"></param>
        /// <param name="Gua"></param>
        /// <param name="Cxl"></param>
        /// <param name="PriceNoTax"></param>
        /// <param name="cutOff"></param>
        /// <param name="planname"></param>
        /// <param name="roomname"></param>
        public void ModH_Cache(int person, int language, int Property_id, string plancode, string Availdate, decimal singlerate, decimal doublerate, decimal triplerate, decimal quadrate, decimal extraadult, decimal extrachildren, int Allotment, int AllotMax, string AvStat, int MaxLos, int MinLos, string RateCode, string RoomCode, string Tcode, string T_from, string T_to, string Roomdesc, string plandesc, string Gua, string Cxl, decimal PriceNoTax, int cutOff, string planname, string roomname)
        {
            string msg = "";
            if (person == 1)
            {
                singlerate = PriceNoTax;
            }
            if (person == 2)
            {
                doublerate = PriceNoTax;
            }
            if (person == 3)
            {
                triplerate = PriceNoTax;
            }
            if (person == 4)
            {
                quadrate = PriceNoTax;
            }
            DataTable table = this._DataAccessLayer.GetTable(string.Concat(new object[] { "select top 1 * from h_cache with(nolock) where property_id=", Property_id, " and plancode='", plancode, "' and availdate='", Availdate, "'" }), "rate");
            if ((table != null) && (table.Rows.Count > 0))
            {
                singlerate = (decimal) table.Rows[0]["singlerate"];
                doublerate = (decimal) table.Rows[0]["doublerate"];
                triplerate = (decimal) table.Rows[0]["triplerate"];
                quadrate = (decimal) table.Rows[0]["quadrate"];
                if (person == 1)
                {
                    singlerate = PriceNoTax;
                }
                if (person == 2)
                {
                    doublerate = PriceNoTax;
                }
                if (person == 3)
                {
                    triplerate = PriceNoTax;
                }
                if (person == 4)
                {
                    quadrate = PriceNoTax;
                }
                this._DataAccessLayer.ExecUpdateSQL("h_cache", new string[] { 
                    "singlerate", "doublerate", "triplerate", "quadrate", "extraadult", "extrachildren", "Allotment", "AllotMax", "AvStat", "MaxLos", "MinLos", "RateCode", "RoomCode", "Tcode", "T_from", "T_to", 
                    "Gua", "Cxl", "PriceNoTax", "cutOff"
                 }, new string[] { 
                    "decimal", "decimal", "decimal", "decimal", "decimal", "decimal", "int", "int", "string", "int", "int", "string", "string", "string", "datetime", "datetime", 
                    "string", "string", "decimal", "int"
                 }, new object[] { 
                    singlerate, doublerate, triplerate, quadrate, extraadult, extrachildren, Allotment, AllotMax, AvStat, MaxLos, MinLos, RateCode, RoomCode, Tcode, T_from, T_to, 
                    Gua, Cxl, PriceNoTax, cutOff
                 }, new string[] { "Property_id", "plancode", "Availdate" }, new string[] { "int", "string", "datetime" }, new object[] { Property_id, plancode, Availdate }, out msg);
            }
            else
            {
                this._DataAccessLayer.ExecInsertSQL("h_cache", new string[] { 
                    "Property_id", "plancode", "Availdate", "singlerate", "doublerate", "triplerate", "quadrate", "extraadult", "extrachildren", "Allotment", "AllotMax", "AvStat", "MaxLos", "MinLos", "RateCode", "RoomCode", 
                    "Tcode", "T_from", "T_to", "Gua", "Cxl", "PriceNoTax", "cutOff"
                 }, new string[] { 
                    "int", "string", "datetime", "decimal", "decimal", "decimal", "decimal", "decimal", "decimal", "int", "int", "string", "int", "int", "string", "string", 
                    "string", "datetime", "datetime", "string", "string", "decimal", "int"
                 }, new object[] { 
                    Property_id, plancode, Availdate, singlerate, doublerate, triplerate, quadrate, extraadult, extrachildren, Allotment, AllotMax, AvStat, MaxLos, MinLos, RateCode, RoomCode, 
                    Tcode, T_from, T_to, Gua, Cxl, PriceNoTax, cutOff
                 }, out msg);
            }
            if (this._DataAccessLayer.RunSqlExists(string.Concat(new object[] { "select top 1 property_id from h_plan with(nolock) where property_id=", Property_id, " and plancode='", plancode, "' and languagetype=", language, " " })))
            {
                this._DataAccessLayer.ExecUpdateSQL("h_plan", new string[] { "roomCode", "planname", "roomname", "roomdesc", "plandesc", "type" }, new string[] { "string", "string", "string", "string", "string", "string" }, new object[] { RoomCode, planname, roomname, Roomdesc, plandesc, "plan" }, new string[] { "Property_id", "plancode", "languagetype" }, new string[] { "int", "string", "int" }, new object[] { Property_id, plancode, language }, out msg);
            }
            else
            {
                this._DataAccessLayer.ExecInsertSQL("h_plan", new string[] { "Property_id", "plancode", "languagetype", "roomCode", "planname", "roomname", "roomdesc", "plandesc", "type" }, new string[] { "int", "string", "int", "string", "string", "string", "string", "string", "string" }, new object[] { Property_id, plancode, language, RoomCode, planname, roomname, Roomdesc, plandesc, "plan" }, out msg);
            }
        }

        public string Portalsendemail(string confnum, string mailtype)
        {
            DataAccessLayer layer = new DataAccessLayer();
            Functions functions = new Functions();
            string str = "";
            layer.ClearParameter();
            layer.addNewParameter("@Confnum", confnum);
            DataTable table = layer.RunStoreDataTable("GetResvAll");
            if (table.Rows.Count != 0)
            {
                int num2 = 0;
                int num3 = 0;
                int num4 = 0;
                int num5 = 0;
                int num = Convert.ToInt32(table.Rows[0]["propertyid"].ToString());
                string str2 = table.Rows[0]["roomtype"].ToString();
                string str3 = table.Rows[0]["rateclass"].ToString();
                string str4 = Convert.ToDateTime(table.Rows[0]["starttime"].ToString()).ToString("yyyy-MM-dd");
                string str5 = Convert.ToDateTime(table.Rows[0]["deptime"].ToString()).ToString("yyyy-MM-dd");
                string str6 = Convert.ToDateTime(table.Rows[0]["departure"].ToString()).ToString("yyyy-MM-dd");
                str6 = (str6 == "1900-01-01") ? "-" : str6;
                num2 = Convert.ToInt32(table.Rows[0]["nights"].ToString());
                num3 = Convert.ToInt32(table.Rows[0]["room"].ToString());
                string str8 = table.Rows[0]["guestfirstname"].ToString();
                string str9 = table.Rows[0]["guestlastname"].ToString();
                string str10 = table.Rows[0]["guestemail"].ToString();
                string str11 = table.Rows[0]["guestphone"].ToString();
                string str12 = table.Rows[0]["guestMP"].ToString();
                string str13 = table.Rows[0]["guestaddressline1"].ToString();
                string str14 = table.Rows[0]["guestaddressline2"].ToString();
                string str15 = table.Rows[0]["guestcity"].ToString();
                string str16 = table.Rows[0]["guestcountry"].ToString();
                string str17 = table.Rows[0]["gueststate"].ToString();
                string str18 = table.Rows[0]["guestzip"].ToString();
                string str19 = table.Rows[0]["cctype"].ToString();
                string str20 = table.Rows[0]["ccnumber"].ToString();
                string str21 = table.Rows[0]["ccname"].ToString();
                string str22 = table.Rows[0]["ccexpyear"].ToString();
                string str23 = table.Rows[0]["ccexpmonth"].ToString();
                string str24 = table.Rows[0]["frequentguestid"].ToString();
                string str25 = table.Rows[0]["iata"].ToString();
                string str26 = table.Rows[0]["remarks"].ToString();
                string str43 = table.Rows[0]["cxlnum"].ToString();
                string str44 = table.Rows[0]["status"].ToString();
                string str45 = string.Empty;
                switch (str44)
                {
                    case "New":
                        str45 = "新预订";
                        break;

                    case "mod":
                        str45 = "修改过的预订";
                        break;

                    case "cxl":
                        str45 = "预订已取消：取消号码" + str43;
                        break;
                }
                string str27 = table.Rows[0]["propertyname"].ToString();
                string str28 = table.Rows[0]["propertyname_e"].ToString();
                string str29 = table.Rows[0]["totalmount"].ToString();
                string str30 = table.Rows[0]["dailyprice"].ToString();
                num4 = Convert.ToInt32(table.Rows[0]["adults"].ToString());
                num5 = Convert.ToInt32(table.Rows[0]["children"].ToString());
                string str31 = table.Rows[0]["planDesc"].ToString();
                string str46 = table.Rows[0]["roomname"].ToString();
                string str32 = table.Rows[0]["roomdesc"].ToString();
                string str33 = table.Rows[0]["canclerule"].ToString();
                string str34 = table.Rows[0]["guaranteerule"].ToString();
                string str35 = table.Rows[0]["taxrule"].ToString();
                string str36 = table.Rows[0]["incomingcall"].ToString();
                string str37 = table.Rows[0]["fromurl"].ToString();
                string str38 = table.Rows[0]["SubSource"].ToString();
                string str39 = table.Rows[0]["lastuser"].ToString();
                string str40 = table.Rows[0]["lastusertype"].ToString();
                string str47 = table.Rows[0]["propertyname_e"].ToString();
                string str48 = table.Rows[0]["propertyname"].ToString();
                string str49 = table.Rows[0]["address1_e"].ToString();
                string str50 = table.Rows[0]["address1"].ToString();
                string str51 = table.Rows[0]["phone"].ToString();
                string str41 = table.Rows[0]["getstatus"].ToString();
                string sQL = "select Title,Title_e,Address1,Address1_e,phone,Checkin,Checkout,fop from hotel where pID=" + num;
                string str53 = this._DataAccessLayer.RunSqlStrings(sQL)[7].ToString();
                string str54 = this.formatCheckInOut(table.Rows[0]["checkin"].ToString());
                string str55 = this.formatCheckInOut(table.Rows[0]["checkout"].ToString());
                StringBuilder builder = new StringBuilder();
                string title = "";
                builder.Append("<table width=100% border=0 cellpadding=5 cellspacing=5 bgcolor=#FFFFFF align=center>");
                if (mailtype == "CC")
                {
                    title = title + "在线支付";
                    builder.Append("<tr><td colspan=\"2\"><div align=\"center\"><strong>" + str48 + "预订修改确认信</strong></div></td></tr>");
                    builder.Append("<tr> <td width=\"50%\">预订确认号：" + confnum + "</td> <td width=\"50%\">预订修改日期：" + DateTime.Now.ToString() + "</td></tr>");
                    builder.Append("<tr> <td colspan=\"2\">感谢您选择 " + str48 + "。您的预订修改成功了。您的预订确认号是" + confnum + "。请使用这个号码以备将来查询，并保留这个邮件作为您订房的凭证。</td></tr>");
                }
                else if (mailtype == "Mod")
                {
                    title = title + str48 + "预订修改确认信";
                    builder.Append("<tr><td colspan=\"2\"><div align=\"center\"><strong>" + str48 + "预订修改确认信</strong></div></td></tr>");
                    builder.Append("<tr> <td width=\"50%\">预订确认号：" + confnum + "</td> <td width=\"50%\">预订修改日期：" + DateTime.Now.ToString() + "</td></tr>");
                    builder.Append("<tr> <td colspan=\"2\">感谢您选择 " + str48 + "。您的预订修改成功了。您的预订确认号是" + confnum + "。请使用这个号码以备将来查询，并保留这个邮件作为您订房的凭证。</td></tr>");
                }
                else if (mailtype == "Cxl")
                {
                    title = str48 + "预订取消确认信";
                    builder.Append("<tr><td colspan=\"2\"><div align=\"center\"><strong>" + str48 + "预订取消确认信</strong></div></td></tr>");
                    builder.Append("<tr> <td width=\"50%\">预订取消确认号：" + str43 + "</td> <td width=\"50%\">预订取消日期：" + DateTime.Now.ToString() + "</td></tr>");
                    builder.Append("<tr> <td colspan=\"2\">感谢您选择 " + str48 + "。您的预订成功取消了。您的预订取消确认号是" + str43 + "。请保留这个号码以备将来查询。</td></tr>");
                }
                else
                {
                    title = str48 + "预订确认信";
                    builder.Append("<tr><td colspan=\"2\"><div align=\"center\"><strong>" + str48 + "预订确认信</strong></div></td></tr>");
                    builder.Append("<tr> <td width=\"50%\">预订确认号：" + confnum + "</td> <td width=\"50%\">预订更新日期：" + DateTime.Now.ToString() + "</td></tr>");
                    builder.Append("<tr> <td colspan=\"2\">" + str45 + "</td></tr>");
                    builder.Append("<tr> <td colspan=\"2\">感谢您选择 " + str48 + "。您的预订成功了。您的预订确认号是" + confnum + "。请使用这个号码以备将来查询，并保留这个邮件作为您订房的凭证。</td></tr>");
                }
                builder.Append("<tr><td colspan=\"2\" bgcolor=\"#CCCCCC\">预订信息：</td></tr>");
                builder.Append("<tr><td colspan=\"2\"><table width=\"98%\" border=\"0\" align=\"center\" cellpadding=\"0\" cellspacing=\"3\"><tr><td width=\"15%\">酒店名称：</td><td width=\"85%\">" + str48 + "</td></tr>");
                builder.Append("<tr><td>酒店地址：</td><td>" + str50 + "</td></tr>");
                builder.Append("<tr><td>酒店电话：</td><td>" + str51 + "</td></tr>");
                builder.Append("<tr><td>抵达日期：</td><td>" + str4 + "</td></tr>");
                builder.Append("<tr><td>离店日期：</td><td>" + str5 + "</td></tr>");
                builder.Append("<tr><td>过夜天数：</td> <td>" + num2 + "</td></tr>");
                builder.Append("<tr><td>房间数：</td><td>" + num3 + "</td></tr>");
                builder.Append("<tr><td>入住人数：</td><td>" + num4.ToString() + "</td></tr>");
                builder.Append("<tr><td>入住房型：</td><td>" + str46 + "</td> </tr>");
                builder.Append("<tr><td>房型描述：</td><td>" + str32 + "</td></tr>");
                builder.Append("<tr><td>价格计划：</td><td>" + str31 + "</td></tr>");
                builder.Append("<tr><td>总价（CNY）：</td><td>" + str29 + "</td></tr>");
                builder.Append("<tr><td>价格明细：<br>（CNY）</td><td>");
                builder.Append("<table width=\"98%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">");
                builder.Append("<tr><td width=\"49%\">日期</td><td width=\"51%\">价格</td></tr>");
                string[] strArray2 = table.Rows[0]["dailyprice"].ToString().Split(new char[] { '|' });
                if ((strArray2 != null) && (strArray2.Length > 1))
                {
                    for (int i = 1; i < strArray2.Length; i++)
                    {
                        string[] strArray3 = strArray2[i].Split(new char[] { ',' });
                        builder.Append("<tr><td>" + strArray3[0].ToString() + "</td><td>" + strArray3[1].ToString() + "</td></tr>");
                    }
                }
                else
                {
                    builder.Append("<tr><td></td><td></td></tr>");
                }
                builder.Append("</table></td></tr></table></td></tr>");
                builder.Append("<tr><td colspan=\"2\" bgcolor=\"#CCCCCC\">客人信息：</td></tr>");
                builder.Append("<tr> <td colspan=\"2\"><table width=\"98%\" border=\"0\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\">");
                builder.Append("<tr><td width=\"15%\">客人姓名：</td><td width=\"85%\">" + str9 + " " + str8 + "</td></tr>");
                builder.Append("<tr><td>备注：</td><td>" + str26 + "</td></tr>");
                builder.Append("<tr><td>客人电话：</td><td>" + str11 + "</td></tr>");
                builder.Append("<tr><td>客人手机：</td><td>" + str12 + "</td>");
                builder.Append("<tr><td>客人email：</td><td>" + str10 + "</td> </tr>");
                builder.Append("</table></td></tr>");
                builder.Append("<tr><td colspan=\"2\" bgcolor=\"#CCCCCC\">支付方式：（CNY）</td></tr>");
                builder.Append("<tr><td colspan=\"2\">现金");
                string[] strArray4 = str53.Split(new char[] { '|' });
                if ((strArray4 != null) && (strArray4.Length > 0))
                {
                    for (int j = 0; j < strArray4.Length; j++)
                    {
                        builder.Append("，" + this.getCredit(strArray4[j].ToString()));
                    }
                }
                builder.Append("</td></tr>");
                builder.Append("<tr><td colspan=\"2\" bgcolor=\"#cccccc\">入住信息：</td></tr>");
                builder.Append("<tr bgcolor=\"#FFFFFF\"><td colspan=\"2\"><table width=\"95%\" border=\"0\" align=\"center\" cellpadding=\"0\" cellspacing=\"4\">");
                builder.Append("<tr><td width=\"15%\">入住状态：</td>");
                builder.Append("<td width=\"35%\">" + this.getStates(Convert.ToInt32(str41)) + "</td>");
                builder.Append("<td width=\"15%\">实际离店日期：</td>");
                builder.Append("<td width=\"35%\">" + str6 + "</td></tr>");
                builder.Append("</table></td></tr>");
                builder.Append("<tr><td colspan=\"2\" bgcolor=\"#CCCCCC\">酒店制度：</td></tr>");
                builder.Append("<tr><td colspan=\"2\"><table width=\"98%\" border=\"0\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\">");
                builder.Append("<tr><td width=\"15%\">担保政策：</td>");
                builder.Append("<td width=\"85%\">" + str34 + "</td></tr>");
                builder.Append("<tr><td>取消政策：</td><td>" + str33 + "</td> </tr>");
                builder.Append("<tr><td>税收类制度：</td><td>" + str35 + "</td></tr>");
                builder.Append("<tr><td>最早进房时间：</td><td>" + str54 + "</td></tr>");
                builder.Append("<tr><td>最晚退房时间：</td><td>" + str55 + "</td></tr>");
                builder.Append("</table></td></tr><tr><td colspan=\"2\">本邮件为自动邮件，无需回复。<br>此致谢忱。祝您旅途愉快。</td></tr></table>");
                string[] mailTo = null;
                if (mailtype == "CC")
                {
                    mailTo = new string[] { "service@hubs1.net" };
                }
                else
                {
                    mailTo = new string[] { "isaac.wang@hubs1.net", str10 };
                }
                try
                {
                    functions.SendHTMLMail(builder.ToString(), title, mailTo, "reservation@jinjianghotels.com", "锦江预订中心");
                }
                catch
                {
                    str = "<font color=red>确认邮件发送有误</font>";
                }
                return str;
            }
            return "对应记录未找到，确认邮件不能发送";
        }

        /// <summary>
        /// FitEngine返回mail 信息
        /// </summary>
        /// <param name="confnum">确认码</param>
        /// <param name="mailtype">mail类型</param>
        /// <returns>mail信息</returns>
        public string sendemail(string confnum, string mailtype)
        {
            DataAccessLayer layer = new DataAccessLayer();
            Functions functions = new Functions();
            string str = "";
            layer.ClearParameter();
            layer.addNewParameter("@Confnum", confnum);
            DataTable table = layer.RunStoreDataTable("GetResvAll");
            CRMFitEngine fit = new CRMFitEngine();
            if (table.Rows.Count != 0)
            {
                int num2 = 0;
                int num3 = 0;
                int num4 = 0;
                int num5 = 0;
                int num = Convert.ToInt32(table.Rows[0]["propertyid"].ToString());
                fit.userid = Convert.ToInt32(table.Rows[0]["userid"].ToString());
                fit.languagetype = 0;
                fit = new FitEngine().GetCRMFitEngine(fit);
                string str2 = table.Rows[0]["roomtype"].ToString();
                string str3 = table.Rows[0]["rateclass"].ToString();
                string str4 = Convert.ToDateTime(table.Rows[0]["starttime"].ToString()).ToString("yyyy-MM-dd");
                string str5 = Convert.ToDateTime(table.Rows[0]["deptime"].ToString()).ToString("yyyy-MM-dd");
                string str6 = Convert.ToDateTime(table.Rows[0]["departure"].ToString()).ToString("yyyy-MM-dd");
                str6 = (str6 == "1900-01-01") ? "-" : str6;
                num2 = Convert.ToInt32(table.Rows[0]["nights"].ToString());
                num3 = Convert.ToInt32(table.Rows[0]["room"].ToString());
                string str8 = table.Rows[0]["guestfirstname"].ToString();
                string str9 = table.Rows[0]["guestlastname"].ToString();
                string str10 = table.Rows[0]["guestemail"].ToString();
                string str11 = table.Rows[0]["guestphone"].ToString();
                string str12 = table.Rows[0]["guestMP"].ToString();
                string str13 = table.Rows[0]["guestaddressline1"].ToString();
                string str14 = table.Rows[0]["guestaddressline2"].ToString();
                string str15 = table.Rows[0]["guestcity"].ToString();
                string str16 = table.Rows[0]["guestcountry"].ToString();
                string str17 = table.Rows[0]["gueststate"].ToString();
                string str18 = table.Rows[0]["guestzip"].ToString();
                string str19 = table.Rows[0]["cctype"].ToString();
                string str20 = table.Rows[0]["ccnumber"].ToString();
                string str21 = table.Rows[0]["ccname"].ToString();
                string str22 = table.Rows[0]["ccexpyear"].ToString();
                string str23 = table.Rows[0]["ccexpmonth"].ToString();
                string str24 = table.Rows[0]["frequentguestid"].ToString();
                string str25 = table.Rows[0]["iata"].ToString();
                string str26 = table.Rows[0]["remarks"].ToString();
                string str43 = table.Rows[0]["cxlnum"].ToString();
                string str44 = table.Rows[0]["status"].ToString();
                string str45 = string.Empty;
                switch (str44)
                {
                    case "New":
                        str45 = "新预订";
                        break;

                    case "mod":
                        str45 = "修改过的预订";
                        break;

                    case "cxl":
                        str45 = "预订已取消：取消号码" + str43;
                        break;
                }
                string str27 = table.Rows[0]["propertyname"].ToString();
                string str28 = table.Rows[0]["propertyname_e"].ToString();
                string str29 = table.Rows[0]["totalmount"].ToString();
                string str30 = table.Rows[0]["dailyprice"].ToString();
                num4 = Convert.ToInt32(table.Rows[0]["adults"].ToString());
                num5 = Convert.ToInt32(table.Rows[0]["children"].ToString());
                string str31 = table.Rows[0]["planDesc"].ToString();
                string str46 = table.Rows[0]["roomname"].ToString();
                string str32 = table.Rows[0]["roomdesc"].ToString();
                string str33 = table.Rows[0]["canclerule"].ToString();
                string str34 = table.Rows[0]["guaranteerule"].ToString();
                string str35 = table.Rows[0]["taxrule"].ToString();
                string str36 = table.Rows[0]["incomingcall"].ToString();
                string str37 = table.Rows[0]["fromurl"].ToString();
                string str38 = table.Rows[0]["SubSource"].ToString();
                string str39 = table.Rows[0]["lastuser"].ToString();
                string str40 = table.Rows[0]["lastusertype"].ToString();
                string str47 = table.Rows[0]["propertyname_e"].ToString();
                string str48 = table.Rows[0]["propertyname"].ToString();
                string str49 = table.Rows[0]["address1_e"].ToString();
                string str50 = table.Rows[0]["address1"].ToString();
                string str51 = table.Rows[0]["phone"].ToString();
                string str41 = table.Rows[0]["getstatus"].ToString();
                string sQL = "select Title,Title_e,Address1,Address1_e,phone,Checkin,Checkout,fop from hotel with(nolock) where pID=" + num;
                string str53 = this._DataAccessLayer.RunSqlStrings(sQL)[7].ToString();
                string str54 = this.formatCheckInOut(table.Rows[0]["checkin"].ToString());
                string str55 = this.formatCheckInOut(table.Rows[0]["checkout"].ToString());
                StringBuilder builder = new StringBuilder();
                string title = "";
                builder.Append("<table width=100% border=0 cellpadding=5 cellspacing=5 bgcolor=#FFFFFF align=center>");
                if (mailtype == "CC")
                {
                    title = title + "在线支付";
                    builder.Append("<tr><td colspan=\"2\"><div align=\"center\"><strong>" + str48 + "预订修改确认信</strong></div></td></tr>");
                    builder.Append("<tr> <td width=\"50%\">预订确认号：" + confnum + "</td> <td width=\"50%\">预订修改日期：" + DateTime.Now.ToString() + "</td></tr>");
                    builder.Append("<tr> <td colspan=\"2\">感谢您选择 " + str48 + "。您的预订修改成功了。您的预订确认号是" + confnum + "。请使用这个号码以备将来查询，并保留这个邮件作为您订房的凭证。</td></tr>");
                }
                else if (mailtype == "Mod")
                {
                    title = title + str48 + "预订修改确认信";
                    builder.Append("<tr><td colspan=\"2\"><div align=\"center\"><strong>" + str48 + "预订修改确认信</strong></div></td></tr>");
                    builder.Append("<tr> <td width=\"50%\">预订确认号：" + confnum + "</td> <td width=\"50%\">预订修改日期：" + DateTime.Now.ToString() + "</td></tr>");
                    builder.Append("<tr> <td colspan=\"2\">感谢您选择 " + str48 + "。您的预订修改成功了。您的预订确认号是" + confnum + "。请使用这个号码以备将来查询，并保留这个邮件作为您订房的凭证。</td></tr>");
                }
                else if (mailtype == "Cxl")
                {
                    title = str48 + "预订取消确认信";
                    builder.Append("<tr><td colspan=\"2\"><div align=\"center\"><strong>" + str48 + "预订取消确认信</strong></div></td></tr>");
                    builder.Append("<tr> <td width=\"50%\">预订取消确认号：" + str43 + "</td> <td width=\"50%\">预订取消日期：" + DateTime.Now.ToString() + "</td></tr>");
                    builder.Append("<tr> <td colspan=\"2\">感谢您选择 " + str48 + "。您的预订成功取消了。您的预订取消确认号是" + str43 + "。请保留这个号码以备将来查询。</td></tr>");
                }
                else
                {
                    title = str48 + "预订确认信";
                    builder.Append("<tr><td colspan=\"2\"><div align=\"center\"><strong>" + str48 + "预订确认信</strong></div></td></tr>");
                    builder.Append("<tr> <td width=\"50%\">预订确认号：" + confnum + "</td> <td width=\"50%\">预订更新日期：" + DateTime.Now.ToString() + "</td></tr>");
                    builder.Append("<tr> <td colspan=\"2\">" + str45 + "</td></tr>");
                    builder.Append("<tr> <td colspan=\"2\">感谢您选择 " + str48 + "。您的预订成功了。您的预订确认号是" + confnum + "。请使用这个号码以备将来查询，并保留这个邮件作为您订房的凭证。</td></tr>");
                }
                builder.Append("<tr><td colspan=\"2\" bgcolor=\"#CCCCCC\">预订信息：</td></tr>");
                builder.Append("<tr><td colspan=\"2\"><table width=\"98%\" border=\"0\" align=\"center\" cellpadding=\"0\" cellspacing=\"3\"><tr><td width=\"15%\">酒店名称：</td><td width=\"85%\">" + str48 + "</td></tr>");
                builder.Append("<tr><td>酒店地址：</td><td>" + str50 + "</td></tr>");
                builder.Append("<tr><td>酒店电话：</td><td>" + str51 + "</td></tr>");
                builder.Append("<tr><td>抵达日期：</td><td>" + str4 + "</td></tr>");
                builder.Append("<tr><td>离店日期：</td><td>" + str5 + "</td></tr>");
                builder.Append("<tr><td>过夜天数：</td> <td>" + num2 + "</td></tr>");
                builder.Append("<tr><td>房间数：</td><td>" + num3 + "</td></tr>");
                builder.Append("<tr><td>入住人数：</td><td>" + num4.ToString() + "</td></tr>");
                builder.Append("<tr><td>入住房型：</td><td>" + str46 + "</td> </tr>");
                builder.Append("<tr><td>房型描述：</td><td>" + str32 + "</td></tr>");
                builder.Append("<tr><td>价格计划：</td><td>" + str31 + "</td></tr>");
                builder.Append("<tr><td>总价（CNY）：</td><td>" + str29 + "</td></tr>");
                builder.Append("<tr><td>价格明细：<br>（CNY）</td><td>");
                builder.Append("<table width=\"98%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">");
                builder.Append("<tr><td width=\"49%\">日期</td><td width=\"51%\">价格</td></tr>");
                string[] strArray2 = table.Rows[0]["dailyprice"].ToString().Split(new char[] { '|' });
                if ((strArray2 != null) && (strArray2.Length > 1))
                {
                    for (int i = 1; i < strArray2.Length; i++)
                    {
                        string[] strArray3 = strArray2[i].Split(new char[] { ',' });
                        builder.Append("<tr><td>" + strArray3[0].ToString() + "</td><td>" + strArray3[1].ToString() + "</td></tr>");
                    }
                }
                else
                {
                    builder.Append("<tr><td></td><td></td></tr>");
                }
                builder.Append("</table></td></tr></table></td></tr>");
                builder.Append("<tr><td colspan=\"2\" bgcolor=\"#CCCCCC\">客人信息：</td></tr>");
                builder.Append("<tr> <td colspan=\"2\"><table width=\"98%\" border=\"0\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\">");
                builder.Append("<tr><td width=\"15%\">客人姓名：</td><td width=\"85%\">" + str9 + " " + str8 + "</td></tr>");
                builder.Append("<tr><td>备注：</td><td>" + str26 + "</td></tr>");
                builder.Append("<tr><td>客人电话：</td><td>" + str11 + "</td></tr>");
                builder.Append("<tr><td>客人手机：</td><td>" + str12 + "</td>");
                builder.Append("<tr><td>客人email：</td><td>" + str10 + "</td> </tr>");
                builder.Append("</table></td></tr>");
                builder.Append("<tr><td colspan=\"2\" bgcolor=\"#CCCCCC\">支付方式：（CNY）</td></tr>");
                builder.Append("<tr><td colspan=\"2\">现金");
                string[] strArray4 = str53.Split(new char[] { '|' });
                if ((strArray4 != null) && (strArray4.Length > 0))
                {
                    for (int j = 0; j < strArray4.Length; j++)
                    {
                        builder.Append("，" + this.getCredit(strArray4[j].ToString()));
                    }
                }
                builder.Append("</td></tr>");
                builder.Append("<tr><td colspan=\"2\" bgcolor=\"#cccccc\">入住信息：</td></tr>");
                builder.Append("<tr bgcolor=\"#FFFFFF\"><td colspan=\"2\"><table width=\"95%\" border=\"0\" align=\"center\" cellpadding=\"0\" cellspacing=\"4\">");
                builder.Append("<tr><td width=\"15%\">入住状态：</td>");
                builder.Append("<td width=\"35%\">" + this.getStates(Convert.ToInt32(str41)) + "</td>");
                builder.Append("<td width=\"15%\">实际离店日期：</td>");
                builder.Append("<td width=\"35%\">" + str6 + "</td></tr>");
                builder.Append("</table></td></tr>");
                builder.Append("<tr><td colspan=\"2\" bgcolor=\"#CCCCCC\">酒店制度：</td></tr>");
                builder.Append("<tr><td colspan=\"2\"><table width=\"98%\" border=\"0\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\">");
                builder.Append("<tr><td width=\"15%\">担保政策：</td>");
                builder.Append("<td width=\"85%\">" + str34 + "</td></tr>");
                builder.Append("<tr><td>取消政策：</td><td>" + str33 + "</td> </tr>");
                builder.Append("<tr><td>税收类制度：</td><td>" + str35 + "</td></tr>");
                builder.Append("<tr><td>最早进房时间：</td><td>" + str54 + "</td></tr>");
                builder.Append("<tr><td>最晚退房时间：</td><td>" + str55 + "</td></tr>");
                builder.Append("</table></td></tr><tr><td colspan=\"2\">本邮件为自动邮件，无需回复。<br>此致谢忱。祝您旅途愉快。</td></tr></table>");
                string[] mailTo = null;
                if (mailtype == "CC")
                {
                    mailTo = new string[] { "service@hubs1.net" };
                }
                else
                {
                    mailTo = new string[] { "isaac.wang@hubs1.net", fit.EmailFrom, str10 };
                }
                try
                {
                    functions.SendHTMLMail(builder.ToString(), title, mailTo, "reservation@jinjianghotels.com", "锦江预订中心");
                }
                catch
                {
                    str = "<font color=red>确认邮件发送有误</font>";
                }
                return str;
            }
            return "对应记录未找到，确认邮件不能发送";
        }

        /// <summary>
        /// 锦江预订引擎使用.获取mail信息,发送mail.
        /// </summary>
        /// <param name="confnum">确认码</param>
        /// <param name="mailtype">mail类型.修改/取消/新预订</param>
        /// <param name="languagetype">中/英文格式</param>
        /// <returns>返回发送状态.成功或失败</returns>
        public string sendemailBookengine(string confnum, string mailtype, int languagetype)
        {
            string[] strArray2;
            int num6;
            string[] strArray3;
            string[] strArray4;
            int num7;
            string[] strArray5;
            string[] emailSetting;
            string str57;
            string str58;
            DataAccessLayer layer = new DataAccessLayer();
            CommonWeb web = new CommonWeb();
            Functions functions = new Functions();
            string str = "";
            layer.ClearParameter();
            layer.addNewParameter("@Confnum", confnum);
            DataTable table = layer.RunStoreDataTable("GetResvAll");
            if (table.Rows.Count == 0)
            {
                return "对应记录未找到，确认邮件不能发送";
            }
            int num2 = 0;
            int num3 = 0;
            int num4 = 0;
            int num5 = 0;
            int pID = Convert.ToInt32(table.Rows[0]["propertyid"].ToString());
            string str2 = table.Rows[0]["roomtype"].ToString();
            string str3 = table.Rows[0]["rateclass"].ToString();
            string date = Convert.ToDateTime(table.Rows[0]["starttime"].ToString()).ToString("yyyy-MM-dd");
            string str5 = Convert.ToDateTime(table.Rows[0]["deptime"].ToString()).ToString("yyyy-MM-dd");
            string str6 = Convert.ToDateTime(table.Rows[0]["departure"].ToString()).ToString("yyyy-MM-dd");
            str6 = (str6 == "1900-01-01") ? "-" : str6;
            num2 = Convert.ToInt32(table.Rows[0]["nights"].ToString());
            num3 = Convert.ToInt32(table.Rows[0]["room"].ToString());
            string str8 = table.Rows[0]["guestfirstname"].ToString();
            string str9 = table.Rows[0]["guestlastname"].ToString();
            string str10 = table.Rows[0]["guestemail"].ToString();
            string str11 = table.Rows[0]["guestphone"].ToString();
            string str12 = table.Rows[0]["guestMP"].ToString();
            string str13 = table.Rows[0]["guestaddressline1"].ToString();
            string str14 = table.Rows[0]["guestaddressline2"].ToString();
            string str15 = table.Rows[0]["guestcity"].ToString();
            string str16 = table.Rows[0]["guestcountry"].ToString();
            string str17 = table.Rows[0]["gueststate"].ToString();
            string str18 = table.Rows[0]["guestzip"].ToString();
            string str19 = table.Rows[0]["cctype"].ToString();
            string str20 = table.Rows[0]["ccnumber"].ToString();
            string str21 = table.Rows[0]["ccname"].ToString();
            string str22 = table.Rows[0]["ccexpyear"].ToString();
            string str23 = table.Rows[0]["ccexpmonth"].ToString();
            string str24 = table.Rows[0]["frequentguestid"].ToString();
            string str25 = table.Rows[0]["iata"].ToString();
            string str26 = table.Rows[0]["remarks"].ToString();
            string str43 = table.Rows[0]["cxlnum"].ToString();
            string str44 = table.Rows[0]["status"].ToString();
            string str45 = string.Empty;
            if (languagetype == 1)
            {
                switch (str44)
                {
                    case "New":
                        str45 = "New Reservation";
                        break;

                    case "mod":
                        str45 = "Modified ";
                        break;

                    case "cxl":
                        str45 = "Cancelled: " + str43;
                        break;
                }
            }
            else
            {
                switch (str44)
                {
                    case "New":
                        str45 = "新预订";
                        break;

                    case "mod":
                        str45 = "修改过的预订";
                        break;

                    case "cxl":
                        str45 = "预订已取消：取消号码" + str43;
                        break;
                }
            }
            string str27 = table.Rows[0]["propertyname"].ToString();
            string str28 = table.Rows[0]["propertyname_e"].ToString();
            string str29 = table.Rows[0]["totalmount"].ToString();
            string str30 = table.Rows[0]["dailyprice"].ToString();
            num4 = Convert.ToInt32(table.Rows[0]["adults"].ToString());
            num5 = Convert.ToInt32(table.Rows[0]["children"].ToString());
            string str31 = table.Rows[0]["planDesc"].ToString();
            string str46 = table.Rows[0]["roomname"].ToString();
            string str32 = table.Rows[0]["roomdesc"].ToString();
            string str33 = table.Rows[0]["canclerule"].ToString();
            string str34 = table.Rows[0]["guaranteerule"].ToString();
            string str35 = table.Rows[0]["taxrule"].ToString();
            string str36 = table.Rows[0]["incomingcall"].ToString();
            string str37 = table.Rows[0]["fromurl"].ToString();
            string str38 = table.Rows[0]["SubSource"].ToString();
            string str39 = table.Rows[0]["lastuser"].ToString();
            string str40 = table.Rows[0]["lastusertype"].ToString();
            string str47 = table.Rows[0]["propertyname_e"].ToString();
            string str48 = table.Rows[0]["propertyname"].ToString();
            string str49 = table.Rows[0]["address1_e"].ToString();
            string str50 = table.Rows[0]["address1"].ToString();
            string str51 = table.Rows[0]["phone"].ToString();
            string str41 = table.Rows[0]["getstatus"].ToString();
            string sQL = "select Title,Title_e,Address1,Address1_e,phone,Checkin,Checkout,fop from hotel where pID=" + pID;
            string str53 = this._DataAccessLayer.RunSqlStrings(sQL)[7].ToString();
            string str54 = this.formatCheckInOut(table.Rows[0]["checkin"].ToString());
            string str55 = this.formatCheckInOut(table.Rows[0]["checkout"].ToString());
            StringBuilder builder = new StringBuilder();
            string title = "";
            if (languagetype == 1)
            {
                builder.Append("<table width=100% border=0 cellpadding=5 cellspacing=5 bgcolor=#FFFFFF align=center>");
                if (mailtype == "Mod")
                {
                    title = title + str47 + "Reservatoin Modification Letter";
                    builder.Append("<tr><td colspan=\"2\"><div align=\"center\"><strong>" + str47 + " Reservatoin Modification Letter</strong></div></td></tr>");
                    builder.Append("<tr> <td width=\"50%\"><strong>Confirmation Number: " + confnum + "</strong></td> <td width=\"50%\">Modification Date: " + web.getDate(DateTime.Now.ToString()) + "</td></tr>");
                    builder.Append("<tr> <td colspan=\"2\">We wish to thank you for choosing " + str47 + "  and are pleased to confirm your reservation as follow.  Please keep this email for your records and refer to this confirmation number in any future correspondence about your reservation.</td></tr>");
                }
                else if (mailtype == "Cxl")
                {
                    title = str47 + "Reservatoin Cancellation Letter";
                    builder.Append("<tr><td colspan=\"2\"><div align=\"center\"><strong>" + str47 + " Reservatoin Cancellation Letter</strong></div></td></tr>");
                    builder.Append("<tr> <td width=\"50%\"><strong>Cancellation Number:" + str43 + "</strong></td> <td width=\"50%\">Cancel Date: " + web.getDate(DateTime.Now.ToString()) + "</td></tr>");
                    builder.Append("<tr> <td colspan=\"2\">We wish to thank you for choosing " + str47 + " and are pleased to confirm your cancellation as follow. Please keep this email for your records and refer to this cancellation number in any future correspondence about your reservation.</td></tr>");
                }
                else
                {
                    title = str47 + " Reservation Confirmation Letter";
                    builder.Append("<tr><td colspan=\"2\"><div align=\"center\"><strong>" + str47 + "  Reservation Confirmation Letter</strong></div></td></tr>");
                    builder.Append("<tr> <td width=\"50%\">Confirmation Number: " + confnum + "</td> <td width=\"50%\">Reservation Date: " + web.getDate(DateTime.Now.ToString()) + "</td></tr>");
                    builder.Append("<tr> <td colspan=\"2\">" + str45 + "</td></tr>");
                    builder.Append("<tr> <td colspan=\"2\">We wish to thank you for choosing " + str47 + " and are pleased to confirm your reservation as follow. Please keep this email for your records and refer to this confirmation number in any future correspondence about your reservation.</td></tr>");
                }
                builder.Append("<tr><td colspan=\"2\" bgcolor=\"#CCCCCC\">Reservation Information:</td></tr>");
                builder.Append("<tr><td colspan=\"2\"><table width=\"98%\" border=\"0\" align=\"center\" cellpadding=\"0\" cellspacing=\"3\"><tr><td width=\"15%\">Hotel Name</td><td width=\"85%\">" + str47 + "</td></tr>");
                builder.Append("<tr><td>Hotel Address</td><td>" + str49 + "</td></tr>");
                builder.Append("<tr><td>Hotel Phone</td><td>" + str51 + "</td></tr>");
                builder.Append("<tr><td>Check In Date</td><td>" + web.getDate(date) + "</td></tr>");
                builder.Append("<tr><td>Check Out Date</td><td>" + web.getDate(str5) + "</td></tr>");
                builder.Append("<tr><td>Number of Nights</td> <td>" + num2 + "</td></tr>");
                builder.Append("<tr><td>Number of Rooms</td><td>" + num3 + "</td></tr>");
                builder.Append("<tr><td>Number of Guests</td><td>" + num4.ToString() + "/room</td></tr>");
                builder.Append("<tr><td>Type of Rooms</td><td>" + str46 + "</td> </tr>");
                builder.Append("<tr><td>Room Description</td><td>" + str32 + "</td></tr>");
                builder.Append("<tr><td>Rate Plan</td><td>" + str31 + "</td></tr>");
                builder.Append("<tr><td>Total Price(CNY)</td><td><strong>" + str29 + " CNY</strong></td></tr>");
                builder.Append("<tr><td>Daily Rate<br>(CNY)</td><td>");
                builder.Append("<table width=\"98%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">");
                builder.Append("<tr><td width=\"49%\">Date</td><td width=\"51%\">Rate</td></tr>");
                strArray2 = table.Rows[0]["dailyprice"].ToString().Split(new char[] { '|' });
                if ((strArray2 != null) && (strArray2.Length > 1))
                {
                    for (num6 = 1; num6 < strArray2.Length; num6++)
                    {
                        strArray3 = strArray2[num6].Split(new char[] { ',' });
                        builder.Append("<tr><td>" + web.getDate(strArray3[0].ToString()) + "</td><td>" + strArray3[1].ToString() + "</td></tr>");
                    }
                }
                else
                {
                    builder.Append("<tr><td></td><td></td></tr>");
                }
                builder.Append("</table></td></tr></table></td></tr>");
                builder.Append("<tr><td colspan=\"2\" bgcolor=\"#CCCCCC\">Guest Information:</td></tr>");
                builder.Append("<tr> <td colspan=\"2\"><table width=\"98%\" border=\"0\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\">");
                builder.Append("<tr><td width=\"20%\">Guest Name</td><td width=\"80%\">" + str8 + " " + str9 + "</td></tr>");
                builder.Append("<tr><td>Guest Phone</td><td>" + str11 + "</td></tr>");
                builder.Append("<tr><td>Guest Mobile Phone</td><td>" + str12 + "</td>");
                builder.Append("<tr><td>Guest Email</td><td>" + str10 + "</td> </tr>");
                builder.Append("<tr><td>Remarks</td><td>" + str26 + "</td></tr>");
                builder.Append("</table></td></tr>");
                builder.Append("<tr><td colspan=\"2\" bgcolor=\"#CCCCCC\">Payment:(CNY)</td></tr>");
                builder.Append("<tr><td colspan=\"2\">Cash");
                strArray4 = str53.Split(new char[] { '|' });
                if ((strArray4 != null) && (strArray4.Length > 0))
                {
                    for (num7 = 0; num7 < strArray4.Length; num7++)
                    {
                        builder.Append(", " + this.getCredit(strArray4[num7].ToString()));
                    }
                }
                builder.Append("</td></tr>");
                builder.Append("<tr><td colspan=\"2\" bgcolor=\"#CCCCCC\">Hotel Policy:</td></tr>");
                builder.Append("<tr><td colspan=\"2\"><table width=\"98%\" border=\"0\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\">");
                builder.Append("<tr><td width=\"20%\">Guarantee Policy</td>");
                builder.Append("<td width=\"80%\">" + str34 + "</td></tr>");
                builder.Append("<tr><td>Cancellation Policy</td><td>" + str33 + "</td> </tr>");
                builder.Append("<tr><td>Tax</td><td>" + str35 + "</td></tr>");
                builder.Append("<tr><td>Check In Time</td><td>" + str54 + "</td></tr>");
                builder.Append("<tr><td>Check Out Time</td><td>" + str55 + "</td></tr>");
                builder.Append("</table></td></tr><tr><td colspan=\"2\">This is an automated e-mail. Please do not reply to this e-mail.<br>Thank you again and enjoy your stay!</td></tr></table>");
                builder.Append("<br> " + this.GetSloganNewResv(pID, 1));
                strArray5 = new string[] { "isaac.wang@hubs1.net", str10 };
                emailSetting = this.GetEmailSetting(pID, 1);
                str57 = "service@jinjianghotels.com";
                str58 = "JinJiang Central Reservation";
                if (emailSetting != null)
                {
                    if (!string.IsNullOrEmpty(emailSetting[0]))
                    {
                        str57 = emailSetting[0];
                    }
                    if (!string.IsNullOrEmpty(emailSetting[1]))
                    {
                        str58 = emailSetting[1];
                    }
                }
                try
                {
                    functions.SendHTMLMail(builder.ToString(), title, strArray5, "reservation@jinjianghotels.com", "锦江预订中心");
                }
                catch
                {
                    str = "<font color=red>Error sending Email</font>";
                }
                return str;
            }
            builder.Append("<table width=100% border=0 cellpadding=5 cellspacing=5 bgcolor=#FFFFFF align=center>");
            if (mailtype == "Mod")
            {
                title = title + str48 + "预订修改确认信";
                builder.Append("<tr><td colspan=\"2\"><div align=\"center\"><strong>" + str48 + "预订修改确认信</strong></div></td></tr>");
                builder.Append("<tr> <td width=\"50%\">预订确认号：" + confnum + "</td> <td width=\"50%\">预订修改日期：" + DateTime.Now.ToString() + "</td></tr>");
                builder.Append("<tr> <td colspan=\"2\">感谢您选择 " + str48 + "。您的预订修改成功了。您的预订确认号是" + confnum + "。请使用这个号码以备将来查询，并保留这个邮件作为您订房的凭证。</td></tr>");
            }
            else if (mailtype == "Cxl")
            {
                title = str48 + "预订取消确认信";
                builder.Append("<tr><td colspan=\"2\"><div align=\"center\"><strong>" + str48 + "预订取消确认信</strong></div></td></tr>");
                builder.Append("<tr> <td width=\"50%\">预订取消确认号：" + str43 + "</td> <td width=\"50%\">预订取消日期：" + DateTime.Now.ToString() + "</td></tr>");
                builder.Append("<tr> <td colspan=\"2\">感谢您选择 " + str48 + "。您的预订成功取消了。您的预订取消确认号是" + str43 + "。请保留这个号码以备将来查询。</td></tr>");
            }
            else
            {
                title = str48 + "预订确认信";
                builder.Append("<tr><td colspan=\"2\"><div align=\"center\"><strong>" + str48 + "预订确认信</strong></div></td></tr>");
                builder.Append("<tr> <td width=\"50%\">预订确认号：" + confnum + "</td> <td width=\"50%\">预订更新日期：" + DateTime.Now.ToString() + "</td></tr>");
                builder.Append("<tr> <td colspan=\"2\">" + str45 + "</td></tr>");
                builder.Append("<tr> <td colspan=\"2\">感谢您选择 " + str48 + "。您的预订成功了。您的预订确认号是" + confnum + "。请使用这个号码以备将来查询，并保留这个邮件作为您订房的凭证。</td></tr>");
            }
            builder.Append("<tr><td colspan=\"2\" bgcolor=\"#CCCCCC\">预订信息：</td></tr>");
            builder.Append("<tr><td colspan=\"2\"><table width=\"98%\" border=\"0\" align=\"center\" cellpadding=\"0\" cellspacing=\"3\"><tr><td width=\"15%\">酒店名称：</td><td width=\"85%\">" + str48 + "</td></tr>");
            builder.Append("<tr><td>酒店地址：</td><td>" + str50 + "</td></tr>");
            builder.Append("<tr><td>酒店电话：</td><td>" + str51 + "</td></tr>");
            builder.Append("<tr><td>抵达日期：</td><td>" + date + "</td></tr>");
            builder.Append("<tr><td>离店日期：</td><td>" + str5 + "</td></tr>");
            builder.Append("<tr><td>过夜天数：</td> <td>" + num2 + "</td></tr>");
            builder.Append("<tr><td>房间数：</td><td>" + num3 + "</td></tr>");
            builder.Append("<tr><td>入住人数：</td><td>" + num4.ToString() + "</td></tr>");
            builder.Append("<tr><td>入住房型：</td><td>" + str46 + "</td> </tr>");
            builder.Append("<tr><td>房型描述：</td><td>" + str32 + "</td></tr>");
            builder.Append("<tr><td>价格计划：</td><td>" + str31 + "</td></tr>");
            builder.Append("<tr><td>总价（CNY）：</td><td>" + str29 + "</td></tr>");
            builder.Append("<tr><td>价格明细：<br>（CNY）</td><td>");
            builder.Append("<table width=\"98%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">");
            builder.Append("<tr><td width=\"49%\">日期</td><td width=\"51%\">价格</td></tr>");
            strArray2 = table.Rows[0]["dailyprice"].ToString().Split(new char[] { '|' });
            if ((strArray2 != null) && (strArray2.Length > 1))
            {
                for (num6 = 1; num6 < strArray2.Length; num6++)
                {
                    strArray3 = strArray2[num6].Split(new char[] { ',' });
                    builder.Append("<tr><td>" + strArray3[0].ToString() + "</td><td>" + strArray3[1].ToString() + "</td></tr>");
                }
            }
            else
            {
                builder.Append("<tr><td></td><td></td></tr>");
            }
            builder.Append("</table></td></tr></table></td></tr>");
            builder.Append("<tr><td colspan=\"2\" bgcolor=\"#CCCCCC\">客人信息：</td></tr>");
            builder.Append("<tr> <td colspan=\"2\"><table width=\"98%\" border=\"0\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\">");
            builder.Append("<tr><td width=\"15%\">客人姓名：</td><td width=\"85%\">" + str9 + " " + str8 + "</td></tr>");
            builder.Append("<tr><td>备注：</td><td>" + str26 + "</td></tr>");
            builder.Append("<tr><td>客人电话：</td><td>" + str11 + "</td></tr>");
            builder.Append("<tr><td>客人手机：</td><td>" + str12 + "</td>");
            builder.Append("<tr><td>客人email：</td><td>" + str10 + "</td> </tr>");
            builder.Append("</table></td></tr>");
            builder.Append("<tr><td colspan=\"2\" bgcolor=\"#CCCCCC\">支付方式：（CNY）</td></tr>");
            builder.Append("<tr><td colspan=\"2\">现金");
            strArray4 = str53.Split(new char[] { '|' });
            if ((strArray4 != null) && (strArray4.Length > 0))
            {
                for (num7 = 0; num7 < strArray4.Length; num7++)
                {
                    builder.Append("，" + this.getCredit(strArray4[num7].ToString()));
                }
            }
            builder.Append("</td></tr>");
            builder.Append("<tr><td colspan=\"2\" bgcolor=\"#cccccc\">入住信息：</td></tr>");
            builder.Append("<tr bgcolor=\"#FFFFFF\"><td colspan=\"2\"><table width=\"95%\" border=\"0\" align=\"center\" cellpadding=\"0\" cellspacing=\"4\">");
            builder.Append("<tr><td width=\"15%\">入住状态：</td>");
            builder.Append("<td width=\"35%\">" + this.getStates(Convert.ToInt32(str41)) + "</td>");
            builder.Append("<td width=\"15%\">实际离店日期：</td>");
            builder.Append("<td width=\"35%\">" + str6 + "</td></tr>");
            builder.Append("</table></td></tr>");
            builder.Append("<tr><td colspan=\"2\" bgcolor=\"#CCCCCC\">酒店制度：</td></tr>");
            builder.Append("<tr><td colspan=\"2\"><table width=\"98%\" border=\"0\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\">");
            builder.Append("<tr><td width=\"15%\">担保政策：</td>");
            builder.Append("<td width=\"85%\">" + str34 + "</td></tr>");
            builder.Append("<tr><td>取消政策：</td><td>" + str33 + "</td> </tr>");
            builder.Append("<tr><td>税收类制度：</td><td>" + str35 + "</td></tr>");
            builder.Append("<tr><td>最早进房时间：</td><td>" + str54 + "</td></tr>");
            builder.Append("<tr><td>最晚退房时间：</td><td>" + str55 + "</td></tr>");
            builder.Append("</table></td></tr><tr><td colspan=\"2\">本邮件为自动邮件，无需回复。<br>此致谢忱。祝您旅途愉快。</td></tr></table>");
            builder.Append("<br> " + this.GetSloganNewResv(pID, 0));
            strArray5 = new string[] { "isaac.wang@hubs1.net", str10 };
            str57 = "service@jinjianghotels.com";
            str58 = "锦江中央预订中心";
            emailSetting = this.GetEmailSetting(pID, 0);
            if (emailSetting != null)
            {
                if (!string.IsNullOrEmpty(emailSetting[0]))
                {
                    str57 = emailSetting[0];
                }
                if (!string.IsNullOrEmpty(emailSetting[1]))
                {
                    str58 = emailSetting[1];
                }
            }
            try
            {
                functions.SendHTMLMail(builder.ToString(), title, strArray5, "reservation@jinjianghotels.com", "锦江预订中心");
            }
            catch
            {
                str = "<font color=red>确认邮件发送有误</font>";
            }
            return str;
        }

        /// <summary>
        /// 发送预订传真
        /// </summary>
        /// <param name="confnum">确认信</param>
        /// <param name="faxno">传真号</param>
        /// <param name="mailtype">mail类型 新预订/修改/取消</param>
        /// <returns>返回发送状态 成功/失败.</returns>
        public string sendfax(string confnum, string faxno, string mailtype)
        {
            DataAccessLayer layer = new DataAccessLayer();
            Functions functions = new Functions();
            string str = "";
            layer.ClearParameter();
            layer.addNewParameter("@Confnum", confnum);
            DataTable table = layer.RunStoreDataTable("GetResvAll");
            if (table.Rows.Count != 0)
            {
                int num2 = 0;
                int num3 = 0;
                int num4 = 0;
                int num5 = 0;
                int num = Convert.ToInt32(table.Rows[0]["propertyid"].ToString());
                string str2 = table.Rows[0]["roomtype"].ToString();
                string str3 = table.Rows[0]["rateclass"].ToString();
                string str4 = Convert.ToDateTime(table.Rows[0]["starttime"].ToString()).ToString("yyyy-MM-dd");
                string str5 = Convert.ToDateTime(table.Rows[0]["deptime"].ToString()).ToString("yyyy-MM-dd");
                string str6 = Convert.ToDateTime(table.Rows[0]["departure"].ToString()).ToString("yyyy-MM-dd");
                str6 = (str6 == "1900-01-01") ? "-" : str6;
                num2 = Convert.ToInt32(table.Rows[0]["nights"].ToString());
                num3 = Convert.ToInt32(table.Rows[0]["room"].ToString());
                string str8 = table.Rows[0]["guestfirstname"].ToString();
                string str9 = table.Rows[0]["guestlastname"].ToString();
                string str10 = table.Rows[0]["guestemail"].ToString();
                string str11 = table.Rows[0]["guestphone"].ToString();
                string str12 = table.Rows[0]["guestMP"].ToString();
                string str13 = table.Rows[0]["guestaddressline1"].ToString();
                string str14 = table.Rows[0]["guestaddressline2"].ToString();
                string str15 = table.Rows[0]["guestcity"].ToString();
                string str16 = table.Rows[0]["guestcountry"].ToString();
                string str17 = table.Rows[0]["gueststate"].ToString();
                string str18 = table.Rows[0]["guestzip"].ToString();
                string str19 = table.Rows[0]["cctype"].ToString();
                string str20 = table.Rows[0]["ccnumber"].ToString();
                string str21 = table.Rows[0]["ccname"].ToString();
                string str22 = table.Rows[0]["ccexpyear"].ToString();
                string str23 = table.Rows[0]["ccexpmonth"].ToString();
                string str24 = table.Rows[0]["frequentguestid"].ToString();
                string str25 = table.Rows[0]["iata"].ToString();
                string str26 = table.Rows[0]["remarks"].ToString();
                string str43 = table.Rows[0]["cxlnum"].ToString();
                string str44 = table.Rows[0]["status"].ToString();
                string str45 = string.Empty;
                switch (str44)
                {
                    case "New":
                        str45 = "新预订";
                        break;

                    case "mod":
                        str45 = "修改过的预订";
                        break;

                    case "cxl":
                        str45 = "预订已取消：取消号码" + str43;
                        break;
                }
                string str27 = table.Rows[0]["propertyname"].ToString();
                string str28 = table.Rows[0]["propertyname_e"].ToString();
                string str29 = table.Rows[0]["totalmount"].ToString();
                string str30 = table.Rows[0]["dailyprice"].ToString();
                num4 = Convert.ToInt32(table.Rows[0]["adults"].ToString());
                num5 = Convert.ToInt32(table.Rows[0]["children"].ToString());
                string str31 = table.Rows[0]["planDesc"].ToString();
                string str46 = table.Rows[0]["roomname"].ToString();
                string str32 = table.Rows[0]["roomdesc"].ToString();
                string str33 = table.Rows[0]["canclerule"].ToString();
                string str34 = table.Rows[0]["guaranteerule"].ToString();
                string str35 = table.Rows[0]["taxrule"].ToString();
                string str36 = table.Rows[0]["incomingcall"].ToString();
                string str37 = table.Rows[0]["fromurl"].ToString();
                string str38 = table.Rows[0]["SubSource"].ToString();
                string str39 = table.Rows[0]["lastuser"].ToString();
                string str40 = table.Rows[0]["lastusertype"].ToString();
                string str47 = table.Rows[0]["propertyname_e"].ToString();
                string str48 = table.Rows[0]["propertyname"].ToString();
                string str49 = table.Rows[0]["address1_e"].ToString();
                string str50 = table.Rows[0]["address1"].ToString();
                string str51 = table.Rows[0]["phone"].ToString();
                string str42 = table.Rows[0]["getstatus"].ToString();
                string sQL = "select Title,Title_e,Address1,Address1_e,phone,Checkin,Checkout,fop from hotel where pID=" + num;
                string str53 = this._DataAccessLayer.RunSqlStrings(sQL)[7].ToString();
                string str54 = this.formatCheckInOut(table.Rows[0]["checkin"].ToString());
                string str55 = this.formatCheckInOut(table.Rows[0]["checkout"].ToString());
                StringBuilder builder = new StringBuilder();
                string str56 = "";
                builder.Append("<table width=100% border=0 cellpadding=0 cellspacing=5 bgcolor=#FFFFFF align=center>");
                if (mailtype == "Mod")
                {
                    str56 = str56 + str48 + "预订修改确认信";
                    builder.Append("<tr><td colspan=\"2\"><div align=\"center\"><strong>" + str48 + "预订修改确认信</strong></div></td></tr>");
                    builder.Append("<tr> <td width=\"50%\">预订确认号：" + confnum + "</td> <td width=\"50%\">预订修改日期：" + DateTime.Now.ToString() + "</td></tr>");
                    builder.Append("<tr> <td colspan=\"2\">感谢您选择 " + str48 + "。您的预订修改成功了。您的预订确认号是" + confnum + "。请使用这个号码以备将来查询，并保留这个邮件作为您订房的凭证。</td></tr>");
                }
                else if (mailtype == "Cxl")
                {
                    str56 = str48 + "预订取消确认信";
                    builder.Append("<tr><td colspan=\"2\"><div align=\"center\"><strong>" + str48 + "预订取消确认信</strong></div></td></tr>");
                    builder.Append("<tr> <td width=\"50%\">预订取消确认号：" + str43 + "</td> <td width=\"50%\">预订取消日期：" + DateTime.Now.ToString() + "</td></tr>");
                    builder.Append("<tr> <td colspan=\"2\">感谢您选择 " + str48 + "。您的预订成功取消了。您的预订取消确认号是" + str43 + "。请保留这个号码以备将来查询。</td></tr>");
                }
                else
                {
                    str56 = str48 + "预订确认信";
                    builder.Append("<tr><td colspan=\"2\"><div align=\"center\"><strong>" + str48 + "预订确认信</strong></div></td></tr>");
                    builder.Append("<tr> <td width=\"50%\">预订确认号：" + confnum + "</td> <td width=\"50%\">预订更新日期：" + DateTime.Now.ToString() + "</td></tr>");
                    builder.Append("<tr> <td colspan=\"2\">" + str45 + "</td></tr>");
                    builder.Append("<tr> <td colspan=\"2\">感谢您选择 " + str48 + "。您的预订成功了。您的预订确认号是" + confnum + "。请使用这个号码以备将来查询，并保留这个邮件作为您订房的凭证。</td></tr>");
                }
                builder.Append("<tr><td colspan=2><table width=100% border=0 cellpadding=5 cellspacing=5 bgcolor=#FFFFFF align=center>");
                builder.Append("<tr><td colspan=\"2\" bgcolor=\"#CCCCCC\">预订信息：</td></tr>");
                builder.Append("<tr><td colspan=\"2\"><table width=\"98%\" border=\"0\" align=\"center\" cellpadding=\"0\" cellspacing=\"3\"><tr><td width=\"15%\">酒店名称：</td><td width=\"35%\">" + str48 + "</td>");
                builder.Append("<td width=\"20%\">酒店电话：</td><td colspan=\"30\">" + str51 + "</td></tr>");
                builder.Append("<tr><td  width=\"15%\">抵达日期：</td><td  width=\"35%\">" + str4 + "</td>");
                builder.Append("<td  width=\"20%\">离店日期：</td><td width=\"30%\">" + str5 + "</td></tr>");
                builder.Append(string.Concat(new object[] { "<tr><td   width=\"15%\">房间数：</td><td width=\"35%\">", num3, "</td><td  width=\"20%\">入住人数：</td><td  width=\"30%\">", num4.ToString(), "</td></tr>" }));
                builder.Append("<tr><td    width=\"15%\">过夜天数：</td> <td  colspan=\"3\">" + num2 + "</td></tr>");
                builder.Append("<tr><td    width=\"15%\">酒店地址：</td><td  colspan=\"3\">" + str50 + "</td></tr>");
                builder.Append("<tr><td>入住房型：</td><td  colspan=\"5\">" + str46 + "</td> </tr>");
                builder.Append("<tr><td>房型描述：</td><td  colspan=\"5\">" + str32 + "</td></tr>");
                builder.Append("<tr><td>价格计划：</td><td   colspan=\"5\">" + str31 + "</td></tr>");
                builder.Append("<tr><td>总价（CNY）：</td><td  colspan=\"5\">" + str29 + "</td></tr>");
                builder.Append("<tr><td>价格明细：<br>（CNY）</td><td colspan=\"5\">");
                builder.Append("<table width=\"98%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">");
                builder.Append("<tr><td width=\"49%\">日期</td><td width=\"51%\">价格</td></tr>");
                string[] strArray2 = table.Rows[0]["dailyprice"].ToString().Split(new char[] { '|' });
                if ((strArray2 != null) && (strArray2.Length > 1))
                {
                    for (int i = 1; i < strArray2.Length; i++)
                    {
                        string[] strArray3 = strArray2[i].Split(new char[] { ',' });
                        builder.Append("<tr><td>" + strArray3[0].ToString() + "</td><td>" + strArray3[1].ToString() + "</td></tr>");
                    }
                }
                else
                {
                    builder.Append("<tr><td></td><td></td></tr>");
                }
                builder.Append("</table></td></tr></table></td></tr>");
                builder.Append("<tr><td colspan=\"2\" bgcolor=\"#CCCCCC\">客人信息：</td></tr>");
                builder.Append("<tr> <td colspan=\"2\"><table width=\"98%\" border=\"0\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\">");
                builder.Append("<tr><td width=\"15%\">客人姓名：</td><td width=\"35%\">" + str9 + str8 + "</td><td>客人email:</td><td>" + str10 + "</td></tr>");
                builder.Append("<tr><td width=\"15%\">备注：</td><td colspan=\"3\">" + str26 + "</td></tr>");
                builder.Append("<tr><td  width=\"15%\">客人电话：</td><td  width=\"35%\">" + str11 + "</td>");
                builder.Append("<td  width=\"15%\">客人手机：</td><td  width=\"35%\">" + str12 + "</td></tr>");
                builder.Append("</table></td></tr>");
                builder.Append("<tr><td colspan=\"2\" bgcolor=\"#CCCCCC\">支付方式：（CNY）</td></tr>");
                builder.Append("<tr><td colspan=\"2\">现金");
                string[] strArray4 = str53.Split(new char[] { '|' });
                if ((strArray4 != null) && (strArray4.Length > 0))
                {
                    for (int j = 0; j < strArray4.Length; j++)
                    {
                        builder.Append("，" + this.getCredit(strArray4[j].ToString()));
                    }
                }
                builder.Append("</td></tr>");
                builder.Append("<tr><td colspan=\"2\" bgcolor=\"#CCCCCC\">入住状态 :</td></tr>");
                builder.Append("<tr><td>入住状态:" + this.getStates(Convert.ToInt32(str42)) + "</td><td>实际离店日期:" + str6 + "</td></tr>");
                builder.Append("<tr><td colspan=\"2\" bgcolor=\"#CCCCCC\">酒店制度：</td></tr>");
                builder.Append("<tr><td colspan=\"2\"><table width=\"98%\" border=\"0\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\">");
                builder.Append("<tr><td width=\"20%\">担保政策：</td>");
                builder.Append("<td width=\"80%\" colspan=\"3\">" + str34 + "</td></tr>");
                builder.Append("<tr><td width=\"20%\">取消政策：</td><td colspan=\"3\">" + str33 + "</td> </tr>");
                builder.Append("<tr><td width=\"20%\">税收类制度：</td><td colspan=\"3\">" + str35 + "</td></tr>");
                builder.Append("<tr><td width=\"20%\">最早进房时间：</td><td width=\"30%\">" + str54 + "</td>");
                builder.Append("<td width=\"20%\">最晚退房时间：</td><td width=\"30%\">" + str55 + "</td></tr></table></td></tr></table></td></tr></table>");
                try
                {
                    string[] mailTo = new string[] { "fax@fax.hubs1.net" };
                    functions.SendHTMLFax(builder.ToString(), faxno, mailTo, "reservation@jinjianghotels.com", "锦江预订中心");
                }
                catch (Exception)
                {
                    str = "<font color=red>传真发送失误</font>";
                }
                return str;
            }
            return "对应记录未找到，确认传真不能发送";
        }

        /// <param name="Webfrom">显示的发送人</param>
        /// <param name="Webmail">显示的发送邮箱</param>
        /// <returns></returns>
        /// <summary>
        /// 根据订单GUID发送传真(Email_Confirmation_[mailtype].txt)
        /// </summary>
        /// <param name="Procedure">存储过程名称,参数为@verifycode.</param>
        /// <param name="url">网站url</param>
        /// <param name="folder">文件目录，可用HttpContext.Current.Request.PhysicalApplicationPath （mail）网站根目录下文件夹</param>
        /// <param name="verifycode">订单Guid</param>
        /// <param name="mailtype">邮件类型</param>
        /// <param name="title">邮件主题</param>
        /// <param name="lantype">语言类型(1:en,0,cn)</param>
        /// <param name="faxphone"></param>
        /// <param name="faxemail"></param>
        /// <returns></returns>
        public string sendFax_GUID(string Procedure, string url, string folder, string verifycode, string mailtype, string title, int lantype, string faxphone, string faxemail)
        {
            string str = "";
            try
            {
                string html = "";
                string path = folder + @"\Fax_Confirmation_" + mailtype + ".txt";
                try
                {
                    StreamReader reader = File.OpenText(path);
                    html = reader.ReadToEnd();
                    reader.Close();
                    reader = null;
                }
                catch (Exception)
                {
                    html = "";
                    if (lantype == 1)
                    {
                        return "Can't find Fax template";
                    }
                    return "没有找到传真模板";
                }
                Functions functions = new Functions();
                DataTable table = CommonDataAccess.ExecProcedure(Procedure, "@verifycode", "string", new object[] { verifycode }, "resvlog");
                if ((table == null) || (table.Rows.Count < 1))
                {
                    if (lantype == 0)
                    {
                        return "对应记录未找到，确认传真不能发送";
                    }
                    return "Can't find this reservation record,please try again";
                }
                string str4 = "";
                string str5 = "";
                if (table.Rows.Count != 0)
                {
                    int num;
                    if (lantype == 0)
                    {
                        str4 = table.Rows[0]["title"].ToString() + title;
                    }
                    else
                    {
                        str4 = table.Rows[0]["title_e"].ToString() + title;
                    }
                    str5 = table.Rows[0]["guestemail"].ToString();
                    string newValue = DateTime.Now.ToString();
                    string str7 = DateTime.Today.ToString("yyyy-MM-dd");
                    html = html.Replace("<%=url%>", url).Replace("<%=now%>", newValue).Replace("<%=date%>", str7);
                    DataRow row = table.Rows[0];
                    string str8 = "";
                    for (num = 0; num < table.Columns.Count; num++)
                    {
                        str8 = table.Columns[num].ColumnName.ToLower().Trim();
                        html = html.Replace("<%=" + str8 + "%>", row[str8].ToString());
                    }
                    string[] strArray = table.Rows[0]["dailyprice"].ToString().Split(new char[] { '|' });
                    StringBuilder builder = new StringBuilder();
                    StringBuilder builder2 = new StringBuilder();
                    StringBuilder builder3 = new StringBuilder();
                    builder.Append("<table  width=\"100%\"  border=\"0\" cellpadding=\"0\" cellspacing=\"0\" class=\"TableList\" > ");
                    for (num = 0; num < (strArray.Length - 1); num += 7)
                    {
                        builder2.Remove(0, builder2.Length);
                        builder3.Remove(0, builder3.Length);
                        builder2.Append("<tr align=\"center\"> ");
                        builder3.Append("<tr align=\"center\">");
                        for (int i = 0; i < 7; i++)
                        {
                            if (((num + i) + 1) < strArray.Length)
                            {
                                builder2.Append("<th class=\"td3\">");
                                builder3.Append("<td  class=\"td4\">");
                                string[] strArray2 = strArray[(num + i) + 1].Split(new char[] { ',' });
                                builder2.Append(strArray2[0]);
                                builder3.Append(strArray2[1]);
                            }
                            else
                            {
                                builder2.Append("<th class=\"td3\">");
                                builder3.Append("<td  class=\"td4\">");
                            }
                            builder3.Append("</td>");
                            builder2.Append("</th>");
                        }
                        builder3.Append("</tr>");
                        builder2.Append("</tr>");
                        builder.Append(builder2);
                        builder.Append(builder3);
                    }
                    builder.Append("</table> ");
                    html = html.Replace("<%=pricelist%>", builder.ToString());
                    string[] mailTo = new string[] { faxemail };
                    try
                    {
                        if (lantype == 0)
                        {
                            functions.SendHTMLUTF8(html, faxphone, mailTo, faxemail, faxemail);
                        }
                        else
                        {
                            functions.SendHTMLUTF8(html, faxphone, mailTo, faxemail, faxemail);
                        }
                    }
                    catch
                    {
                        if (lantype == 0)
                        {
                            str = "<font color=red>确认传真发送有误</font>";
                        }
                        else
                        {
                            str = "<font color=red>Fax delivery failed!</font>";
                        }
                    }
                    return str;
                }
                if (lantype == 0)
                {
                    str = "对应记录未找到，确认传真不能发送";
                }
                else
                {
                    str = "Can't find this reservation record,please try again";
                }
            }
            catch (Exception)
            {
                if (lantype == 1)
                {
                    str = "Can't find Fax template";
                }
                else
                {
                    str = "没有找到传真模板";
                }
            }
            return str;
        }

        /// <summary>
        /// FGBEngine返回mail 信息
        /// </summary>
        /// <param name="confnum">确认码</param>
        /// <param name="mailtype">mail类型</param>
        /// <param name="EmailFrom">发件人邮箱</param>
        /// <param name="EmailAlias">发件人</param>
        /// <returns>mail信息</returns>
        public string sendFGBemail(string confnum, string mailtype, string EmailFrom, string EmailAlias)
        {
            DataAccessLayer layer = new DataAccessLayer();
            Functions functions = new Functions();
            string str = "";
            layer.ClearParameter();
            layer.addNewParameter("@Confnum", confnum);
            DataTable table = layer.RunStoreDataTable("GetResvAll");
            if (table.Rows.Count != 0)
            {
                int num2 = 0;
                int num3 = 0;
                int num4 = 0;
                int num5 = 0;
                int num = Convert.ToInt32(table.Rows[0]["propertyid"].ToString());
                string str2 = table.Rows[0]["roomtype"].ToString();
                string str3 = table.Rows[0]["rateclass"].ToString();
                string str4 = Convert.ToDateTime(table.Rows[0]["starttime"].ToString()).ToString("yyyy-MM-dd");
                string str5 = Convert.ToDateTime(table.Rows[0]["deptime"].ToString()).ToString("yyyy-MM-dd");
                string str6 = Convert.ToDateTime(table.Rows[0]["departure"].ToString()).ToString("yyyy-MM-dd");
                str6 = (str6 == "1900-01-01") ? "-" : str6;
                num2 = Convert.ToInt32(table.Rows[0]["nights"].ToString());
                num3 = Convert.ToInt32(table.Rows[0]["room"].ToString());
                string str8 = table.Rows[0]["guestfirstname"].ToString();
                string str9 = table.Rows[0]["guestlastname"].ToString();
                string str10 = table.Rows[0]["guestemail"].ToString();
                string str11 = table.Rows[0]["guestphone"].ToString();
                string str12 = table.Rows[0]["guestMP"].ToString();
                string str13 = table.Rows[0]["guestaddressline1"].ToString();
                string str14 = table.Rows[0]["guestaddressline2"].ToString();
                string str15 = table.Rows[0]["guestcity"].ToString();
                string str16 = table.Rows[0]["guestcountry"].ToString();
                string str17 = table.Rows[0]["gueststate"].ToString();
                string str18 = table.Rows[0]["guestzip"].ToString();
                string str19 = table.Rows[0]["cctype"].ToString();
                string str20 = table.Rows[0]["ccnumber"].ToString();
                string str21 = table.Rows[0]["ccname"].ToString();
                string str22 = table.Rows[0]["ccexpyear"].ToString();
                string str23 = table.Rows[0]["ccexpmonth"].ToString();
                string str24 = table.Rows[0]["frequentguestid"].ToString();
                string str25 = table.Rows[0]["iata"].ToString();
                string str26 = table.Rows[0]["remarks"].ToString();
                string str43 = table.Rows[0]["cxlnum"].ToString();
                string str44 = table.Rows[0]["status"].ToString();
                string str45 = string.Empty;
                switch (str44)
                {
                    case "New":
                        str45 = "新预订";
                        break;

                    case "mod":
                        str45 = "修改过的预订";
                        break;

                    case "cxl":
                        str45 = "预订已取消：取消号码" + str43;
                        break;
                }
                string str27 = table.Rows[0]["propertyname"].ToString();
                string str28 = table.Rows[0]["propertyname_e"].ToString();
                string str29 = table.Rows[0]["totalmount"].ToString();
                string str30 = table.Rows[0]["dailyprice"].ToString();
                num4 = Convert.ToInt32(table.Rows[0]["adults"].ToString());
                num5 = Convert.ToInt32(table.Rows[0]["children"].ToString());
                string str31 = table.Rows[0]["planDesc"].ToString();
                string str46 = table.Rows[0]["roomname"].ToString();
                string str32 = table.Rows[0]["roomdesc"].ToString();
                string str33 = table.Rows[0]["canclerule"].ToString();
                string str34 = table.Rows[0]["guaranteerule"].ToString();
                string str35 = table.Rows[0]["taxrule"].ToString();
                string str36 = table.Rows[0]["incomingcall"].ToString();
                string str37 = table.Rows[0]["fromurl"].ToString();
                string str38 = table.Rows[0]["SubSource"].ToString();
                string str39 = table.Rows[0]["lastuser"].ToString();
                string str40 = table.Rows[0]["lastusertype"].ToString();
                string str47 = table.Rows[0]["propertyname_e"].ToString();
                string str48 = table.Rows[0]["propertyname"].ToString();
                string str49 = table.Rows[0]["address1_e"].ToString();
                string str50 = table.Rows[0]["address1"].ToString();
                string str51 = table.Rows[0]["phone"].ToString();
                string str41 = table.Rows[0]["getstatus"].ToString();
                string sQL = "select Title,Title_e,Address1,Address1_e,phone,Checkin,Checkout,fop from hotel where pID=" + num;
                string str53 = this._DataAccessLayer.RunSqlStrings(sQL)[7].ToString();
                string str54 = this.formatCheckInOut(table.Rows[0]["checkin"].ToString());
                string str55 = this.formatCheckInOut(table.Rows[0]["checkout"].ToString());
                StringBuilder builder = new StringBuilder();
                string title = "";
                builder.Append("<table width=100% border=0 cellpadding=5 cellspacing=5 bgcolor=#FFFFFF align=center>");
                if (mailtype == "CC")
                {
                    title = title + "在线支付";
                    builder.Append("<tr><td colspan=\"2\"><div align=\"center\"><strong>" + str48 + "预订修改确认信</strong></div></td></tr>");
                    builder.Append("<tr> <td width=\"50%\">预订确认号：" + confnum + "</td> <td width=\"50%\">预订修改日期：" + DateTime.Now.ToString() + "</td></tr>");
                    builder.Append("<tr> <td colspan=\"2\">感谢您选择 " + str48 + "。您的预订修改成功了。您的预订确认号是" + confnum + "。请使用这个号码以备将来查询，并保留这个邮件作为您订房的凭证。</td></tr>");
                }
                else if (mailtype == "Mod")
                {
                    title = title + str48 + "预订修改确认信";
                    builder.Append("<tr><td colspan=\"2\"><div align=\"center\"><strong>" + str48 + "预订修改确认信</strong></div></td></tr>");
                    builder.Append("<tr> <td width=\"50%\">预订确认号：" + confnum + "</td> <td width=\"50%\">预订修改日期：" + DateTime.Now.ToString() + "</td></tr>");
                    builder.Append("<tr> <td colspan=\"2\">感谢您选择 " + str48 + "。您的预订修改成功了。您的预订确认号是" + confnum + "。请使用这个号码以备将来查询，并保留这个邮件作为您订房的凭证。</td></tr>");
                }
                else if (mailtype == "Cxl")
                {
                    title = str48 + "预订取消确认信";
                    builder.Append("<tr><td colspan=\"2\"><div align=\"center\"><strong>" + str48 + "预订取消确认信</strong></div></td></tr>");
                    builder.Append("<tr> <td width=\"50%\">预订取消确认号：" + str43 + "</td> <td width=\"50%\">预订取消日期：" + DateTime.Now.ToString() + "</td></tr>");
                    builder.Append("<tr> <td colspan=\"2\">感谢您选择 " + str48 + "。您的预订成功取消了。您的预订取消确认号是" + str43 + "。请保留这个号码以备将来查询。</td></tr>");
                }
                else
                {
                    title = str48 + "预订确认信";
                    builder.Append("<tr><td colspan=\"2\"><div align=\"center\"><strong>" + str48 + "预订确认信</strong></div></td></tr>");
                    builder.Append("<tr> <td width=\"50%\">预订确认号：" + confnum + "</td> <td width=\"50%\">预订更新日期：" + DateTime.Now.ToString() + "</td></tr>");
                    builder.Append("<tr> <td colspan=\"2\">" + str45 + "</td></tr>");
                    builder.Append("<tr> <td colspan=\"2\">感谢您选择 " + str48 + "。您的预订成功了。您的预订确认号是" + confnum + "。请使用这个号码以备将来查询，并保留这个邮件作为您订房的凭证。</td></tr>");
                }
                builder.Append("<tr><td colspan=\"2\" bgcolor=\"#CCCCCC\">预订信息：</td></tr>");
                builder.Append("<tr><td colspan=\"2\"><table width=\"98%\" border=\"0\" align=\"center\" cellpadding=\"0\" cellspacing=\"3\"><tr><td width=\"15%\">酒店名称：</td><td width=\"85%\">" + str48 + "</td></tr>");
                builder.Append("<tr><td>酒店地址：</td><td>" + str50 + "</td></tr>");
                builder.Append("<tr><td>酒店电话：</td><td>" + str51 + "</td></tr>");
                builder.Append("<tr><td>抵达日期：</td><td>" + str4 + "</td></tr>");
                builder.Append("<tr><td>离店日期：</td><td>" + str5 + "</td></tr>");
                builder.Append("<tr><td>过夜天数：</td> <td>" + num2 + "</td></tr>");
                builder.Append("<tr><td>房间数：</td><td>" + num3 + "</td></tr>");
                builder.Append("<tr><td>入住人数：</td><td>" + num4.ToString() + "</td></tr>");
                builder.Append("<tr><td>入住房型：</td><td>" + str46 + "</td> </tr>");
                builder.Append("<tr><td>房型描述：</td><td>" + str32 + "</td></tr>");
                builder.Append("<tr><td>价格计划：</td><td>" + str31 + "</td></tr>");
                builder.Append("<tr><td>总价（CNY）：</td><td>" + str29 + "</td></tr>");
                builder.Append("<tr><td>价格明细：<br>（CNY）</td><td>");
                builder.Append("<table width=\"98%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">");
                builder.Append("<tr><td width=\"49%\">日期</td><td width=\"51%\">价格</td></tr>");
                string[] strArray2 = table.Rows[0]["dailyprice"].ToString().Split(new char[] { '|' });
                if ((strArray2 != null) && (strArray2.Length > 1))
                {
                    for (int i = 1; i < strArray2.Length; i++)
                    {
                        string[] strArray3 = strArray2[i].Split(new char[] { ',' });
                        builder.Append("<tr><td>" + strArray3[0].ToString() + "</td><td>" + strArray3[1].ToString() + "</td></tr>");
                    }
                }
                else
                {
                    builder.Append("<tr><td></td><td></td></tr>");
                }
                builder.Append("</table></td></tr></table></td></tr>");
                builder.Append("<tr><td colspan=\"2\" bgcolor=\"#CCCCCC\">客人信息：</td></tr>");
                builder.Append("<tr> <td colspan=\"2\"><table width=\"98%\" border=\"0\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\">");
                builder.Append("<tr><td width=\"15%\">客人姓名：</td><td width=\"85%\">" + str9 + " " + str8 + "</td></tr>");
                builder.Append("<tr><td>备注：</td><td>" + str26 + "</td></tr>");
                builder.Append("<tr><td>客人电话：</td><td>" + str11 + "</td></tr>");
                builder.Append("<tr><td>客人手机：</td><td>" + str12 + "</td>");
                builder.Append("<tr><td>客人email：</td><td>" + str10 + "</td> </tr>");
                builder.Append("</table></td></tr>");
                builder.Append("<tr><td colspan=\"2\" bgcolor=\"#CCCCCC\">支付方式：（CNY）</td></tr>");
                builder.Append("<tr><td colspan=\"2\">现金");
                string[] strArray4 = str53.Split(new char[] { '|' });
                if ((strArray4 != null) && (strArray4.Length > 0))
                {
                    for (int j = 0; j < strArray4.Length; j++)
                    {
                        builder.Append("，" + this.getCredit(strArray4[j].ToString()));
                    }
                }
                builder.Append("</td></tr>");
                builder.Append("<tr><td colspan=\"2\" bgcolor=\"#cccccc\">入住信息：</td></tr>");
                builder.Append("<tr bgcolor=\"#FFFFFF\"><td colspan=\"2\"><table width=\"95%\" border=\"0\" align=\"center\" cellpadding=\"0\" cellspacing=\"4\">");
                builder.Append("<tr><td width=\"15%\">入住状态：</td>");
                builder.Append("<td width=\"35%\">" + this.getStates(Convert.ToInt32(str41)) + "</td>");
                builder.Append("<td width=\"15%\">实际离店日期：</td>");
                builder.Append("<td width=\"35%\">" + str6 + "</td></tr>");
                builder.Append("</table></td></tr>");
                builder.Append("<tr><td colspan=\"2\" bgcolor=\"#CCCCCC\">酒店制度：</td></tr>");
                builder.Append("<tr><td colspan=\"2\"><table width=\"98%\" border=\"0\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\">");
                builder.Append("<tr><td width=\"15%\">担保政策：</td>");
                builder.Append("<td width=\"85%\">" + str34 + "</td></tr>");
                builder.Append("<tr><td>取消政策：</td><td>" + str33 + "</td> </tr>");
                builder.Append("<tr><td>税收类制度：</td><td>" + str35 + "</td></tr>");
                builder.Append("<tr><td>最早进房时间：</td><td>" + str54 + "</td></tr>");
                builder.Append("<tr><td>最晚退房时间：</td><td>" + str55 + "</td></tr>");
                builder.Append("</table></td></tr><tr><td colspan=\"2\">本邮件为自动邮件，无需回复。<br>此致谢忱。祝您旅途愉快。</td></tr></table>");
                string[] mailTo = null;
                if (mailtype == "CC")
                {
                    mailTo = new string[] { "service@hubs1.net" };
                }
                else
                {
                    mailTo = new string[] { "isaac.wang@hubs1.net", str10 };
                }
                try
                {
                    functions.SendHTMLMail(builder.ToString(), title, mailTo, "reservation@jinjianghotels.com", "锦江预订中心");
                }
                catch (Exception exception)
                {
                    str = "<font color=red>确认邮件发送有误:" + exception.Message + "</font>";
                }
                return str;
            }
            return "对应记录未找到，确认邮件不能发送";
        }

        /// <summary>
        /// 根据订单GUID以及webconfig中webfrom,webmail 发送html邮件,2008-4-18 field
        /// </summary>
        /// <param name="verifycode">确认码</param>
        /// <param name="folder">HTML模板文件夹,在调用页面的同级目录</param>
        /// <param name="mailtype">mail类型</param>
        /// <param name="lantype">语言版本</param>
        /// <returns>mail信息</returns>
        public string sendHTMLConfigEmail_GUID(string verifycode, string folder, string mailtype, int lantype, bool IsAjax)
        {
            string webfrom = ConfigurationManager.AppSettings["webfrom"].ToString();
            string webmail = ConfigurationManager.AppSettings["webmail"].ToString();
            return this.sendHTMLEmail_GUID(verifycode, folder, mailtype, lantype, webfrom, webmail, IsAjax);
        }

        /// <summary>
        /// 返回mail 信息
        /// </summary>
        /// <param name="confnum">确认码</param>
        /// <param name="folder">HTML模板文件夹,在调用页面的同级目录</param>
        /// <param name="mailtype">mail类型</param>
        /// <param name="lantype">语言版本</param>
        /// <returns>mail信息</returns>
        public string sendHTMLEmail(string confnum, string folder, string mailtype, int lantype, bool IsAjax)
        {
            string str = "";
            try
            {
                string newValue = IsAjax ? HttpContext.Current.Request.UrlReferrer.ToString().Split(new char[] { '?' })[0] : HttpContext.Current.Request.Url.ToString().Split(new char[] { '?' })[0];
                int length = newValue.LastIndexOf("/");
                newValue = newValue.Substring(0, length);
                string msgbody = "";
                string path = HttpContext.Current.Request.PhysicalApplicationPath + folder + @"\Email_Confirmation_" + mailtype + ".txt";
                try
                {
                    StreamReader reader = File.OpenText(path);
                    msgbody = reader.ReadToEnd();
                    reader.Close();
                    reader = null;
                }
                catch (Exception)
                {
                    msgbody = "";
                    if (lantype == 1)
                    {
                        return "Can't find Email template";
                    }
                    return "没有找到邮件模板";
                }
                DataAccessLayer layer = new DataAccessLayer();
                Functions functions = new Functions();
                layer.ClearParameter();
                layer.addNewParameter("@Confnum", confnum);
                DataTable table = layer.RunStoreDataTable("FIT_MailGetResvAll");
                string title = "";
                string str6 = "";
                string str7 = "";
                if (table.Rows.Count != 0)
                {
                    int num2;
                    if (lantype == 0)
                    {
                        str7 = table.Rows[0]["title"].ToString();
                        if (mailtype == "CC")
                        {
                            title = title + "在线支付";
                        }
                        else if (mailtype == "Mod")
                        {
                            title = title + str7 + "预订修改确认信";
                        }
                        else if (mailtype == "Cxl")
                        {
                            title = str7 + "预订取消确认信";
                        }
                        else
                        {
                            title = str7 + "预订确认信";
                        }
                    }
                    else
                    {
                        str7 = table.Rows[0]["title_e"].ToString();
                        if (mailtype == "CC")
                        {
                            title = title + "Online payment";
                        }
                        else if (mailtype == "Mod")
                        {
                            title = title + str7 + "Reservatoin Modification Letter";
                        }
                        else if (mailtype == "Cxl")
                        {
                            title = str7 + "Reservatoin Cancellation Letter";
                        }
                        else
                        {
                            title = str7 + "Reservation Confirmation Letter";
                        }
                    }
                    str6 = table.Rows[0]["guestemail"].ToString();
                    string str8 = DateTime.Now.ToString();
                    string str9 = DateTime.Today.ToString("yyyy-MM-dd");
                    msgbody = msgbody.Replace("<%=url%>", newValue).Replace("<%=now%>", str8).Replace("<%=date%>", str9);
                    DataRow row = table.Rows[0];
                    string str10 = "";
                    for (num2 = 0; num2 < table.Columns.Count; num2++)
                    {
                        str10 = table.Columns[num2].ColumnName.ToLower().Trim();
                        msgbody = msgbody.Replace("<%=" + str10 + "%>", row[str10].ToString());
                    }
                    string[] strArray = table.Rows[0]["dailyprice"].ToString().Split(new char[] { '|' });
                    StringBuilder builder = new StringBuilder();
                    StringBuilder builder2 = new StringBuilder();
                    StringBuilder builder3 = new StringBuilder();
                    builder.Append("<table  width=\"100%\"  border=\"0\" cellpadding=\"0\" cellspacing=\"0\" > ");
                    for (num2 = 0; num2 < (strArray.Length - 1); num2 += 7)
                    {
                        builder2.Remove(0, builder2.Length);
                        builder3.Remove(0, builder3.Length);
                        builder2.Append("<tr align=\"center\"> ");
                        builder3.Append("<tr align=\"center\">");
                        for (int i = 0; i < 7; i++)
                        {
                            builder3.Append("<td  class=\"td4\">");
                            builder2.Append("<td class=\"td3\">");
                            if (((num2 + i) + 1) < strArray.Length)
                            {
                                string[] strArray2 = strArray[(num2 + i) + 1].Split(new char[] { ',' });
                                builder2.Append(strArray2[0]);
                                builder3.Append(strArray2[1]);
                            }
                            builder3.Append("</td>");
                            builder2.Append("</td>");
                        }
                        builder3.Append("</tr>");
                        builder2.Append("</tr>");
                        builder.Append(builder2);
                        builder.Append(builder3);
                    }
                    builder.Append("</table> ");
                    msgbody = msgbody.Replace("<%=pricelist%>", builder.ToString());
                    string[] mailTo = null;
                    if (mailtype == "CC")
                    {
                        mailTo = new string[] { "service@hubs1.net" };
                    }
                    else
                    {
                        mailTo = new string[] { "isaac.wang@hubs1.net", str6 };
                    }
                    try
                    {
                        if (lantype == 0)
                        {
                            functions.SendHTMLMail(msgbody, title, mailTo, "reservation@jinjianghotels.com", "锦江预订中心");
                        }
                        else
                        {
                            functions.SendHTMLMail(msgbody, title, mailTo, "reservation@jinjianghotels.com", "JinJiang Reservation Center");
                        }
                    }
                    catch
                    {
                        if (lantype == 0)
                        {
                            str = "<font color=red>确认邮件发送有误</font>";
                        }
                        else
                        {
                            str = "<font color=red>E-mail delivery failed!</font>";
                        }
                    }
                    return str;
                }
                if (lantype == 0)
                {
                    str = "对应记录未找到，确认邮件不能发送";
                }
                else
                {
                    str = "Can't find this reservation record,please try again";
                }
            }
            catch (Exception)
            {
                if (lantype == 1)
                {
                    str = "Can't find Email template";
                }
                else
                {
                    str = "没有找到邮件模板";
                }
            }
            return str;
        }

        /// <summary>
        /// 根据订单GUID发送html邮件 field 2008-12-05 修改为 SendHTMLUTF8 方法发送邮件
        /// </summary>
        /// <param name="verifycode">订单确认号（DFBGUID）</param>
        /// <param name="folder">邮件目录（mail）</param>
        /// <param name="mailtype">邮件类型</param>
        /// <param name="lantype">语言类型(1:en,0,cn)</param>
        /// <param name="IsAjax">是否ajax调用</param>
        /// <returns></returns>
        public string sendHTMLEmail_GUID(string verifycode, string folder, string mailtype, int lantype, bool IsAjax)
        {
            string str = "";
            try
            {
                string newValue = IsAjax ? HttpContext.Current.Request.UrlReferrer.ToString().Split(new char[] { '?' })[0] : HttpContext.Current.Request.Url.ToString().Split(new char[] { '?' })[0];
                int length = newValue.LastIndexOf("/");
                newValue = newValue.Substring(0, length);
                string msgbody = "";
                string path = HttpContext.Current.Request.PhysicalApplicationPath + folder + @"\Email_Confirmation_" + mailtype + ".txt";
                try
                {
                    StreamReader reader = File.OpenText(path);
                    msgbody = reader.ReadToEnd();
                    reader.Close();
                    reader = null;
                }
                catch (Exception)
                {
                    msgbody = "";
                    if (lantype == 1)
                    {
                        return "Can't find Email template";
                    }
                    return "没有找到邮件模板";
                }
                DataAccessLayer layer = new DataAccessLayer();
                Functions functions = new Functions();
                layer.ClearParameter();
                layer.addNewParameter("@verifycode", verifycode);
                DataTable table = layer.RunStoreDataTable("FIT_MailGetResvAll_GUID");
                string title = "";
                string str6 = "";
                string str7 = "";
                if (table.Rows.Count != 0)
                {
                    int num2;
                    if (lantype == 0)
                    {
                        str7 = table.Rows[0]["title"].ToString();
                        if (mailtype == "CC")
                        {
                            title = title + "在线支付";
                        }
                        else if (mailtype == "Mod")
                        {
                            title = title + str7 + "预订修改确认信";
                        }
                        else if (mailtype == "Cxl")
                        {
                            title = str7 + "预订取消确认信";
                        }
                        else
                        {
                            title = str7 + "预订确认信";
                        }
                    }
                    else
                    {
                        str7 = table.Rows[0]["title_e"].ToString();
                        if (mailtype == "CC")
                        {
                            title = title + "Online payment";
                        }
                        else if (mailtype == "Mod")
                        {
                            title = title + str7 + "Reservatoin Modification Letter";
                        }
                        else if (mailtype == "Cxl")
                        {
                            title = str7 + "Reservatoin Cancellation Letter";
                        }
                        else
                        {
                            title = str7 + "Reservation Confirmation Letter";
                        }
                    }
                    str6 = table.Rows[0]["guestemail"].ToString();
                    string str8 = DateTime.Now.ToString();
                    string str9 = DateTime.Today.ToString("yyyy-MM-dd");
                    msgbody = msgbody.Replace("<%=url%>", newValue).Replace("<%=now%>", str8).Replace("<%=date%>", str9);
                    DataRow row = table.Rows[0];
                    string str10 = "";
                    for (num2 = 0; num2 < table.Columns.Count; num2++)
                    {
                        str10 = table.Columns[num2].ColumnName.ToLower().Trim();
                        msgbody = msgbody.Replace("<%=" + str10 + "%>", row[str10].ToString());
                    }
                    string[] strArray = table.Rows[0]["dailyprice"].ToString().Split(new char[] { '|' });
                    StringBuilder builder = new StringBuilder();
                    StringBuilder builder2 = new StringBuilder();
                    StringBuilder builder3 = new StringBuilder();
                    builder.Append("<table  width=\"100%\"  border=\"0\" cellpadding=\"0\" cellspacing=\"0\" > ");
                    for (num2 = 0; num2 < (strArray.Length - 1); num2 += 7)
                    {
                        builder2.Remove(0, builder2.Length);
                        builder3.Remove(0, builder3.Length);
                        builder2.Append("<tr align=\"center\"> ");
                        builder3.Append("<tr align=\"center\">");
                        for (int i = 0; i < 7; i++)
                        {
                            builder3.Append("<td  class=\"td4\">");
                            builder2.Append("<td class=\"td3\">");
                            if (((num2 + i) + 1) < strArray.Length)
                            {
                                string[] strArray2 = strArray[(num2 + i) + 1].Split(new char[] { ',' });
                                builder2.Append(strArray2[0]);
                                builder3.Append(strArray2[1]);
                            }
                            builder3.Append("</td>");
                            builder2.Append("</td>");
                        }
                        builder3.Append("</tr>");
                        builder2.Append("</tr>");
                        builder.Append(builder2);
                        builder.Append(builder3);
                    }
                    builder.Append("</table> ");
                    msgbody = msgbody.Replace("<%=pricelist%>", builder.ToString());
                    string[] mailTo = null;
                    if (mailtype == "CC")
                    {
                        mailTo = new string[] { "service@hubs1.net", str6 };
                    }
                    else
                    {
                        mailTo = new string[] { "isaac.wang@hubs1.net", str6 };
                    }
                    try
                    {
                        if (lantype == 0)
                        {
                            functions.SendHTMLMail(msgbody, title, mailTo, "reservation@jinjianghotels.com", "锦江预订中心");
                        }
                        else
                        {
                            functions.SendHTMLMail(msgbody, title, mailTo, "reservation@jinjianghotels.com", "JinJiang Reservation Center");
                        }
                    }
                    catch
                    {
                        if (lantype == 0)
                        {
                            str = "<font color=red>确认邮件发送有误</font>";
                        }
                        else
                        {
                            str = "<font color=red>E-mail delivery failed!</font>";
                        }
                    }
                    return str;
                }
                if (lantype == 0)
                {
                    str = "对应记录未找到，确认邮件不能发送";
                }
                else
                {
                    str = "Can't find this reservation record,please try again";
                }
            }
            catch (Exception)
            {
                if (lantype == 1)
                {
                    str = "Can't find Email template";
                }
                else
                {
                    str = "没有找到邮件模板";
                }
            }
            return str;
        }

        /// <summary>
        /// 根据订单GUID发送html邮件
        /// </summary>
        /// <param name="verifycode">订单确认号（DFBGUID）</param>
        /// <param name="folder">邮件目录（mail）</param>
        /// <param name="mailtype">邮件类型</param>
        /// <param name="lantype">语言类型(1:en,0,cn)</param>
        /// <param name="Webfrom">显示的发送人</param>
        /// <param name="Webmail">显示的发送邮箱</param>
        /// <param name="IsAjax">是否ajax调用</param>
        /// <returns></returns>
        public string sendHTMLEmail_GUID(string verifycode, string folder, string mailtype, int lantype, string Webfrom, string Webmail, bool IsAjax)
        {
            string str = "";
            try
            {
                string newValue = IsAjax ? HttpContext.Current.Request.UrlReferrer.ToString().Split(new char[] { '?' })[0] : HttpContext.Current.Request.Url.ToString().Split(new char[] { '?' })[0];
                int length = newValue.LastIndexOf("/");
                newValue = newValue.Substring(0, length);
                string html = "";
                string path = HttpContext.Current.Request.PhysicalApplicationPath + folder + @"\Email_Confirmation_" + mailtype + ".txt";
                try
                {
                    StreamReader reader = File.OpenText(path);
                    html = reader.ReadToEnd();
                    reader.Close();
                    reader = null;
                }
                catch (Exception)
                {
                    html = "";
                    if (lantype == 1)
                    {
                        return "Can't find Email template";
                    }
                    return "没有找到邮件模板";
                }
                DataAccessLayer layer = new DataAccessLayer();
                Functions functions = new Functions();
                layer.ClearParameter();
                layer.addNewParameter("@verifycode", verifycode);
                DataTable table = layer.RunStoreDataTable("FIT_MailGetResvAll_GUID");
                string title = "";
                string str6 = "";
                string str7 = "";
                if (table.Rows.Count != 0)
                {
                    int num2;
                    if (lantype == 0)
                    {
                        str7 = table.Rows[0]["title"].ToString();
                        if (mailtype == "CC")
                        {
                            title = title + "在线支付";
                        }
                        else if (mailtype == "Mod")
                        {
                            title = title + str7 + "预订修改确认信";
                        }
                        else if (mailtype == "Cxl")
                        {
                            title = str7 + "预订取消确认信";
                        }
                        else
                        {
                            title = str7 + "预订确认信";
                        }
                    }
                    else
                    {
                        str7 = table.Rows[0]["title_e"].ToString();
                        if (mailtype == "CC")
                        {
                            title = title + "Online payment";
                        }
                        else if (mailtype == "Mod")
                        {
                            title = title + str7 + "Reservatoin Modification Letter";
                        }
                        else if (mailtype == "Cxl")
                        {
                            title = str7 + "Reservatoin Cancellation Letter";
                        }
                        else
                        {
                            title = str7 + "Reservation Confirmation Letter";
                        }
                    }
                    str6 = table.Rows[0]["guestemail"].ToString();
                    string str8 = DateTime.Now.ToString();
                    string str9 = DateTime.Today.ToString("yyyy-MM-dd");
                    html = html.Replace("<%=url%>", newValue).Replace("<%=now%>", str8).Replace("<%=date%>", str9);
                    DataRow row = table.Rows[0];
                    string str10 = "";
                    for (num2 = 0; num2 < table.Columns.Count; num2++)
                    {
                        str10 = table.Columns[num2].ColumnName.ToLower().Trim();
                        html = html.Replace("<%=" + str10 + "%>", row[str10].ToString());
                    }
                    string[] strArray = table.Rows[0]["dailyprice"].ToString().Split(new char[] { '|' });
                    StringBuilder builder = new StringBuilder();
                    StringBuilder builder2 = new StringBuilder();
                    StringBuilder builder3 = new StringBuilder();
                    builder.Append("<table  width=\"100%\"  border=\"0\" cellpadding=\"0\" cellspacing=\"0\" > ");
                    for (num2 = 0; num2 < (strArray.Length - 1); num2 += 7)
                    {
                        builder2.Remove(0, builder2.Length);
                        builder3.Remove(0, builder3.Length);
                        builder2.Append("<tr align=\"center\"> ");
                        builder3.Append("<tr align=\"center\">");
                        for (int i = 0; i < 7; i++)
                        {
                            builder3.Append("<td  class=\"td4\">");
                            builder2.Append("<td class=\"td3\">");
                            if (((num2 + i) + 1) < strArray.Length)
                            {
                                string[] strArray2 = strArray[(num2 + i) + 1].Split(new char[] { ',' });
                                builder2.Append(strArray2[0]);
                                builder3.Append(strArray2[1]);
                            }
                            builder3.Append("</td>");
                            builder2.Append("</td>");
                        }
                        builder3.Append("</tr>");
                        builder2.Append("</tr>");
                        builder.Append(builder2);
                        builder.Append(builder3);
                    }
                    builder.Append("</table> ");
                    html = html.Replace("<%=pricelist%>", builder.ToString());
                    string[] mailTo = null;
                    if (mailtype == "CC")
                    {
                        mailTo = new string[] { "service@hubs1.net", str6 };
                    }
                    else
                    {
                        mailTo = new string[] { "isaac.wang@hubs1.net", str6 };
                    }
                    try
                    {
                        if (lantype == 0)
                        {
                            functions.SendHTMLUTF8(html, title, mailTo, Webmail, Webfrom);
                        }
                        else
                        {
                            functions.SendHTMLUTF8(html, title, mailTo, Webmail, Webfrom);
                        }
                    }
                    catch
                    {
                        if (lantype == 0)
                        {
                            str = "<font color=red>确认邮件发送有误</font>";
                        }
                        else
                        {
                            str = "<font color=red>E-mail delivery failed!</font>";
                        }
                    }
                    return str;
                }
                if (lantype == 0)
                {
                    str = "对应记录未找到，确认邮件不能发送";
                }
                else
                {
                    str = "Can't find this reservation record,please try again";
                }
            }
            catch (Exception)
            {
                if (lantype == 1)
                {
                    str = "Can't find Email template";
                }
                else
                {
                    str = "没有找到邮件模板";
                }
            }
            return str;
        }

        /// <summary>
        /// 根据订单GUID发送html邮件，模板文件名称为(Email_Confirmation_[mailtype].txt)
        /// </summary>
        /// <param name="Procedure">存储过程名称,参数为@verifycode.</param>
        /// <param name="url">网站url</param>
        /// <param name="folder">文件目录，可用HttpContext.Current.Request.PhysicalApplicationPath （mail）网站根目录下文件夹</param>
        /// <param name="verifycode">订单Guid</param>
        /// <param name="mailtype">邮件类型</param>
        /// <param name="title">邮件主题</param>
        /// <param name="lantype">语言类型(1:en,0,cn)</param>
        /// <param name="Webfrom">显示的发送人</param>
        /// <param name="Webmail">显示的发送邮箱</param>
        /// <returns></returns>
        public string sendHTMLEmail_GUID(string Procedure, string url, string folder, string verifycode, string mailtype, string title, int lantype, string Webfrom, string Webmail)
        {
            string str = "";
            try
            {
                string html = "";
                string path = folder + @"\Email_Confirmation_" + mailtype + ".txt";
                try
                {
                    StreamReader reader = File.OpenText(path);
                    html = reader.ReadToEnd();
                    reader.Close();
                    reader = null;
                }
                catch (Exception)
                {
                    html = "";
                    if (lantype == 1)
                    {
                        return "Can't find Email template";
                    }
                    return "没有找到邮件模板";
                }
                Functions functions = new Functions();
                DataTable table = CommonDataAccess.ExecProcedure(Procedure, "@verifycode", "string", new object[] { verifycode }, "resvlog");
                if ((table == null) || (table.Rows.Count < 1))
                {
                    if (lantype == 0)
                    {
                        return "对应记录未找到，确认邮件不能发送";
                    }
                    return "Can't find this reservation record,please try again";
                }
                string str4 = "";
                string str5 = "";
                if (table.Rows.Count != 0)
                {
                    int num;
                    if (lantype == 0)
                    {
                        str4 = table.Rows[0]["title"].ToString() + title;
                    }
                    else
                    {
                        str4 = table.Rows[0]["title_e"].ToString() + title;
                    }
                    str5 = table.Rows[0]["guestemail"].ToString();
                    string newValue = DateTime.Now.ToString();
                    string str7 = DateTime.Today.ToString("yyyy-MM-dd");
                    html = html.Replace("<%=url%>", url).Replace("<%=now%>", newValue).Replace("<%=date%>", str7);
                    DataRow row = table.Rows[0];
                    string resvInfoValue = ResvInfoUtil.GetResvInfoValue(table.Rows[0]["ResvInfo"].ToString(), ResvInfoType.holdTime);
                    html = html.Replace("<%=guestholdtime%>", resvInfoValue);
                    string str9 = "";
                    for (num = 0; num < table.Columns.Count; num++)
                    {
                        str9 = table.Columns[num].ColumnName.ToLower().Trim();
                        html = html.Replace("<%=" + str9 + "%>", row[str9].ToString());
                    }
                    string[] strArray = table.Rows[0]["dailyprice"].ToString().Split(new char[] { '|' });
                    StringBuilder builder = new StringBuilder();
                    StringBuilder builder2 = new StringBuilder();
                    StringBuilder builder3 = new StringBuilder();
                    builder.Append("<table  width=\"100%\"  border=\"0\" cellpadding=\"0\" cellspacing=\"0\" class=\"TableList\" > ");
                    for (num = 0; num < (strArray.Length - 1); num += 7)
                    {
                        builder2.Remove(0, builder2.Length);
                        builder3.Remove(0, builder3.Length);
                        builder2.Append("<tr align=\"center\"> ");
                        builder3.Append("<tr align=\"center\">");
                        for (int i = 0; i < 7; i++)
                        {
                            if (((num + i) + 1) < strArray.Length)
                            {
                                builder2.Append("<th class=\"td3\">");
                                builder3.Append("<td  class=\"td4\">");
                                string[] strArray2 = strArray[(num + i) + 1].Split(new char[] { ',' });
                                builder2.Append(strArray2[0]);
                                builder3.Append(strArray2[1]);
                            }
                            else
                            {
                                builder2.Append("<th class=\"td3\">");
                                builder3.Append("<td  class=\"td4\">");
                            }
                            builder3.Append("</td>");
                            builder2.Append("</th>");
                        }
                        builder3.Append("</tr>");
                        builder2.Append("</tr>");
                        builder.Append(builder2);
                        builder.Append(builder3);
                    }
                    builder.Append("</table> ");
                    html = html.Replace("<%=pricelist%>", builder.ToString());
                    string[] mailTo = null;
                    string[] strArray4 = Webmail.Split(new char[] { ',' });
                    int num3 = strArray4.Length - 1;
                    mailTo = new string[2 + num3];
                    if (mailtype == "CC")
                    {
                        mailTo[0] = "service@hubs1.net";
                    }
                    else
                    {
                        mailTo[0] = "isaac.wang@hubs1.net";
                    }
                    mailTo[1] = str5;
                    for (num = 1; num < strArray4.Length; num++)
                    {
                        mailTo[num + 1] = strArray4[num];
                    }
                    try
                    {
                        if (lantype == 0)
                        {
                            functions.SendHTMLUTF8(html, str4, mailTo, strArray4[0], Webfrom);
                        }
                        else
                        {
                            functions.SendHTMLUTF8(html, str4, mailTo, strArray4[0], Webfrom);
                        }
                    }
                    catch
                    {
                        if (lantype == 0)
                        {
                            str = "<font color=red>确认邮件发送有误</font>";
                        }
                        else
                        {
                            str = "<font color=red>E-mail delivery failed!</font>";
                        }
                    }
                    return str;
                }
                if (lantype == 0)
                {
                    str = "对应记录未找到，确认邮件不能发送";
                }
                else
                {
                    str = "Can't find this reservation record,please try again";
                }
            }
            catch (Exception)
            {
                if (lantype == 1)
                {
                    str = "Can't find Email template";
                }
                else
                {
                    str = "没有找到邮件模板";
                }
            }
            return str;
        }
    }
}

